Methods and systems for public and private-key leveled fully homomorphic encryption without bootstrapping with hensel codes

ABSTRACT

Disclosed are methods and systems to provide public and private-key leveled Fully Homomorphic Encryption (FHE) systems using Hensel Codes and p-adic and g-adic properties for encryption and decryption that also provide for homomorphic arithmetic operations on encrypted ciphertexts. A source device may encrypt the ciphertext of a message using Hensel Codes, then deliver the ciphertext to either a destination device or an intermediary device. When the intermediary device receives the ciphertext from the source device, the intermediary device may homomorphically perform Hensel Code arithmetic computations with the ciphertext and at least one additional ciphertext and send the result ciphertext to the destination device. The destination device decrypts the ciphertext, giving the original message when no computations have been performed by the intermediary device, or the unencrypted result equivalent to the unencrypted computations performed on the ciphertexts by the intermediary device.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is based upon and claims the benefit of U.S. provisional application Ser. No. 63/150,884, filed Feb. 18, 2021, entitled “Private-Key Leveled Fully Homomorphic Encryption Without Bootstrapping With Hensel Codes,” all of which is also specifically incorporated herein by reference for all that it discloses and teaches.

BACKGROUND OF THE INVENTION

The advancement of science is possible when knowledge is shared and information is exchanged in a seamless manner. In a world where many businesses rely on information as their main assets, analysis over data is a crucial competitive advantage. Consequently, the amount of data processed and stored will continue to increase, creating a demand for virtualized services. To this end, some applications can be provided as cloud computing resources including Internet of Things (IoT), machine learning, virtual reality (VR) and blockchain. As a result, concerns about custody and privacy of data are on the rise.

Modern concealment/encryption employs mathematical techniques that manipulate positive integers or binary bits. Asymmetric concealment/encryption, such as RSA (Rivest-Shamir-Adleman), relies on number theoretic one-way functions that are predictably difficult to factor and can be made more difficult with an ever-increasing size of the encryption keys. Symmetric encryption, such as DES (Data Encryption Standard) and AES (Advanced Encryption Standard), uses bit manipulations within registers to shuffle the concealed text/cryptotext to increase “diffusion” as well as register-based operations with a shared key to increase “confusion.” Diffusion and confusion are measures for the increase in statistical entropy on the data payload being transmitted. The concepts of diffusion and confusion in encryption are normally attributed as first being identified by Claude Shannon in the 1940s. Diffusion is generally thought of as complicating the mathematical process of generating unencrypted (plain text) data from the encrypted (cryptotext) data, thus, making it difficult to discover the encryption key of the concealment/encryption process by spreading the influence of each piece of the unencrypted (plain) data across several pieces of the concealed/encrypted (cryptotext) data. Consequently, an encryption system that has a high degree of diffusion will typically change several characters of the concealed/encrypted (cryptotext) data for the change of a single character in the unencrypted (plain) data making it difficult for an attacker to identify changes in the unencrypted (plain) data. Confusion is generally thought of as obscuring the relationship between the unencrypted (plain) data and the concealed/encrypted (cryptotext) data. Accordingly, a concealment/encryption system that has a high degree of confusion would entail a process that drastically changes the unencrypted (plain) data into the concealed/encrypted (cryptotext) data in a way that, even when an attacker knows the operation of the concealment/encryption method (such as the public standards of RSA, DES, and/or AES), it is still difficult to deduce the encryption key.

Homomorphic Encryption is a form of encryption that allows computations to be carried out on concealed cipher text as it is concealed/encrypted without decrypting the cipher text that generates a concealed/encrypted result which, when decrypted, matches the result of operations performed on the unencrypted plaintext.

The word homomorphism comes from the ancient Greek language: óμó (homos) meaning “same” and μoρφ{acute over (η)}(morphe) meaning “form” or “shape.” Homomorphism may have different definitions depending on the field of use. In mathematics, for example, homomorphism may be considered a transformation of a first set into a second set where the relationship between the elements of the first set are preserved in the relationship of the elements of the second set.

For instance, a map f between sets A and B is a homomorphism of A into B if

f(a ₁ op a ₂)=f(a ₁)op f(a ₂)|a ₁ ,a ₂ ∈A

where “op” is the respective group operation defining the relationship between A and B.

More specifically, for abstract algebra, the term homomorphism may be a structure-preserving map between two algebraic structures such as groups, rings, or vector spaces. Isomorphisms, automorphisms, and endomorphisms are typically considered special types of homomorphisms. Among other more specific definitions of homomorphism, algebra homomorphism may be considered a homomorphism that preserves the algebra structure between two sets.

SUMMARY OF THE INVENTION

An embodiment of the present invention may comprise a method for private-key Fully Homomorphic Encryption (FHE) communication of a message m between a source computing device and a destination computing device, the method comprising: generating by the source computing device prime numbers p₁ . . . p₅ as a function of provided parameters λ and d; setting by the source computing device a secret key sk to be comprised of the prime numbers p₁ . . . p₅ wherein the secret key is known to both of the source computing device and the destination computing device but not to other computing devices; setting by the source computing device a public evaluation key evk to be equal to a product (Π_(i=1) ⁵ p_(i)) of the prime numbers p₁ . . . p₅ wherein the evk also equals a g of Hensel Code g-adic computations (H_(g)); generating by the source computing device values s₁, s₂, s₃, and δ as a function of the prime numbers p₂ . . . p₄, the parameter λ, and the value g; encrypting by the source computing device the message m as ciphertext c in accord with Hensel Code encryption computation c=|H_(g)(s₁·{tilde over (H)}_(p) ₁ _(,p) ₂ _(,p) ₃ ⁻¹(0, s₂, s₃)+δp₄)|_(g); sending by the source computing device the ciphertext c to the destination computing device; decrypting by the destination computing device the ciphertext c back into the message m in accord with Hensel Code decryption computation m=H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₄ ⁻¹(c))).

An embodiment of the present invention may further comprise the method of the preceding paragraph: wherein the process of sending by the source computing device the ciphertext c to the destination computing device instead sends the ciphertext c to an intermediary computing device; wherein the intermediary computing device does not have knowledge of the secret key sk, but does have knowledge of the public evaluation key evk that equals the g of the Hensel Code g-adic computations (H_(g)); wherein the method of claim 1 further comprises: homomorphically computing by the intermediary computing device at least one arithmetic function with the ciphertext c and at least one additional ciphertext c_(additional) in accord with Hensel Code arithmetic functions over integers modulo g to obtain a result ciphertext c_(result); and sending by the intermediary computing device the result ciphertext c_(result) in place of the ciphertext c to the destination computing device; and wherein the process of decrypting by the destination computing device the ciphertext c back into the message m instead decrypts the ciphertext c_(result) to obtain a result r equal to an unencrypted computation of the arithmetic functions homomorphically performed as the Hensel code arithmetic functions with the ciphertext c and the at least one additional ciphertext c_(additional).

An embodiment of the present invention may further comprise a method for public-key Fully Homomorphic Encryption (FHE) communication of a message m between a source computing device and a destination computing device, the method comprising: generating by the source computing device prime numbers p₁, p₂, p₃, and p′₄ as a function of provided parameters λ and d; computing by the source computing device a value p₄ as a function of the prime number p′₄ and the parameters λ and d; setting by the source computing device a value g of Hensel Code g-adic computations (H_(g)) to a product of the values p₁, p₂, p₃, p₄ and a value g′ of Hensel Code g′-adic computations (H_(g′)) to a product of the values p₃, p₄; generating by the source computing device values t and δ_(e) as a function of the parameters λ and d; computing by the source computing device a value e in accord with Hensel Code value e computation e=H_(g)(H_(p) ₃ ({tilde over (H)}_(p) ₁ _(,p) ₂ ⁻¹(0, t))+δ_(e)p₃); setting by the source computing device a secret key sk to be comprised of the prime numbers p₁ and p₃ wherein the secret key sk is known to both of the source computing device and the destination computing device but not to other computing devices; setting by the source computing device a public key pk to be comprised of the values e, g′, g=evk; generating by the source computing device values s₁, s₂ as a function of the parameter λ, and a value δ as a function of the values p₁, p₂, p₄; encrypting by the source computing device the message m as ciphertext c in accord with Hensel Code encryption computation c=H_(g)(H_(g′)(s₁e+m)+s₂g′+S(g′)²); sending by the source computing device the ciphertext c to the destination computing device; decrypting by the destination computing device the ciphertext c back into the message m in accord with Hensel Code decryption computation m=H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₃ ⁻¹(c))).

An embodiment of the present invention may further comprise the method the preceding paragraph: wherein the process of sending by the source computing device the ciphertext c to the destination computing device instead sends the ciphertext c to an intermediary computing device; wherein the intermediary computing device does not have knowledge of the secret key sk, but does have knowledge of the public key pk that includes the g of the Hensel Code g-adic computations (H_(g)); wherein the method of claim 4 further comprises: homomorphically computing by the intermediary computing device at least one arithmetic function with the ciphertext c at least one additional ciphertext c_(additional) in accord with Hensel Code arithmetic functions over integers modulo g to obtain a result ciphertext c_(result); and sending by the intermediary computing device the result ciphertext c_(result) in place of the ciphertext c to the destination computing device; and wherein the process of decrypting by the destination computing device the ciphertext c back into the message m instead decrypts the ciphertext c_(result) to obtain a result r equal to an unencrypted computation of the arithmetic functions homomorphically performed as the Hensel code arithmetic functions with the ciphertext c and the at least one additional ciphertext c_(additional).

An embodiment of the present invention may further comprise a private-key leveled Fully Homomorphic Encryption (FHE) system that communicates a message m between a source computing device and a destination computing device, the private-key leveled FHE system comprising: the source computing device, wherein the source device further comprises: a Gen subsystem that generates device prime numbers p₁ . . . p₅ as a function of provided parameters and d, sets a secret key sk to be comprised of the prime numbers p₁ . . . p₅ wherein the secret key is known to both of the source computing device and the destination computing device but not to other computing devices, sets a public evaluation key evk to be equal to a product (Π_(i=1) ⁵ p_(i)) of the prime numbers p₁ . . . p₅ wherein the evk also equals a g of Hensel Code g-adic computations (H_(g)); an Enc subsystem that generates device values s₁, s₂, s₃, and δ as a function of the prime numbers p₂ . . . p₄, the parameter λ, and the value g, encrypts the message m as ciphertext c in accord with Hensel Code encryption computation c=|H_(g)(s₁·{tilde over (H)}_(p) ₁ _(,p) ₂ _(,p) ₃ ⁻¹(0, s₂, s₃)+δp₄)|_(g); a ciphertext send subsystem that sends the ciphertext c to the destination computing device; and the destination computing device, wherein the destination computing device further comprises: a Dec subsystem that decrypts the ciphertext c back into the message m in accord with Hensel Code decryption computation m=H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₄ ⁻¹(c))).

An embodiment of the present invention may further comprise the private-key leveled FHE system of preceding paragraph: wherein the ciphertext send subsystem sends the ciphertext c to an intermediary computing device; wherein the intermediary computing device does not have knowledge of the secret key sk, but does have knowledge of the public evaluation key evk that equals the g of the Hensel Code g-adic computations (H_(g)); wherein the private-key leveled FHE system of claim 9 further comprises: an Eval subsystem that homomorphically computes at least one arithmetic function with the ciphertext c and at least one additional ciphertext c_(additional) in accord with Hensel Code arithmetic functions over integers modulo g to obtain a result ciphertext c_(result); and a result ciphertext send subsystem that sends the result ciphertext c_(result) in place of the ciphertext c to the destination computing device; and wherein the Dec subsystem decrypts the ciphertext c_(result) to obtain a result r equal to an unencrypted computation of the arithmetic functions homomorphically performed as the Hensel code arithmetic functions with the ciphertext c and the at least one additional ciphertext c_(additional).

An embodiment of the present invention may further comprise a public-key leveled Fully Homomorphic Encryption (FHE) system that communicates a message m between a source computing device and a destination computing device, the private-key leveled FHE system comprising: the source computing device, wherein the source device further comprises: a Gen subsystem that generates prime numbers p₁, p₂, p₃, and p′₄ as a function of provided parameters 2 and d, computes a value p₄ as a function of the prime number p′₄ and the parameters λ and d, sets a value g of Hensel Code g-adic computations (H_(g)) to a product of the values p₁, p₂, p₃, p₄ and a value g′ of Hensel Code g′-adic computations (H_(g′)) to a product of the values p₃, p₄, generates values t and δ_(e) as a function of the parameters λ and d, computes a value e in accord with Hensel Code value e computation e=H_(g)(H_(p) ₃ ({tilde over (H)}_(p) ₁ _(,p) ₂ ⁻¹(0, t))+δ_(e)p₃), sets a secret key sk to be comprised of the prime numbers p₁ and p₃ wherein the secret key sk is known to both of the source computing device and the destination computing device but not to other computing devices, and sets a public key pk to be comprised of the values e, g′, g=evk; an Enc subsystem that generates values s₁, s₂ as a function of the parameter λ, and a value δ as a function of the values p₁, p₂, p₄, and encrypts the message m as ciphertext c in accord with Hensel Code encryption computation c=H_(g)(H_(g′)(s₁e+m)+s₂g′+δ(g′)²); a ciphertext send subsystem that sends the ciphertext c to the destination computing device; and the destination computing device, wherein the destination computing device further comprises: a Dec subsystem that decrypts the ciphertext c back into the message m in accord with Hensel Code decryption computation m=H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₃ ⁻¹(c))).

An embodiment of the present invention may further comprise the public-key leveled FHE system of the preceding paragraph: wherein the ciphertext send subsystem sends the ciphertext c to an intermediary computing device; wherein the intermediary computing device does not have knowledge of the secret key sk, but does have knowledge of the public key pk that includes the g of the Hensel Code g-adic computations (H_(g)) wherein the private-key leveled FHE system of claim 9 further comprises: an Eval subsystem that homomorphically computes at least one arithmetic function with the ciphertext c and at least one additional ciphertext c_(additional) in accord with Hensel Code arithmetic functions over integers modulo g to obtain a result ciphertext c_(result); and a result ciphertext send subsystem that sends the result ciphertext c_(result) in place of the ciphertext c to the destination computing device; and wherein the Dec subsystem decrypts the ciphertext c_(result) to obtain a result r equal to an unencrypted computation of the arithmetic functions homomorphically performed as the Hensel code arithmetic functions with the ciphertext c and the at least one additional ciphertext c_(additional).

BRIEF DESCRIPTION OF THE DRAWINGS

In the drawings,

FIG. 1 is a block diagram of the hardware implementation for a private or public-key leveled Fully Homomorphic Encryption (FHE) embodiment.

FIG. 2 is a flow chart of operations for a private-key leveled FHE embodiment.

FIG. 3 is a flow chart of operations for a public-key leveled FHE embodiment.

DETAILED DESCRIPTION OF THE EMBODIMENTS

We propose the use of Hensel codes (a mathematical tool lifted from the theory of p-adic numbers) as an alternative way to construct Fully Homomorphic Encryption (FHE) schemes that rely on the hardness of some instance of the Approximate Greatest Common Divisor (AGCD) problem. We provide a self-contained introduction to Hensel codes which covers all the properties of interest for this work. Two constructions are presented: a private-key leveled FHE scheme and a public-key leveled FHE scheme. The public-key scheme is obtained via minor modifications to the private-key scheme in which we explore asymmetric properties of Hensel codes. The efficiency and security (under an AGCD variant) of the public-key scheme are discussed in detail. Our constructions take messages from large specialized subsets of the rational numbers that admit fractional numerical inputs and associated computations for virtually any real-world application. Further, our results can be seen as a natural unification of error-free computation (computation free of rounding errors over rational numbers) and homomorphic encryption. Experimental results indicate the scheme is practical for a large variety of applications.

1. Introduction

Homomorphic Encryption (HE) is a type of encryption that enables meaningful and general computation over encrypted data. This notion, originally referred to as privacy homomorphisms, was introduced in 1978. Although every single instance of practical homomorphic computation can be interesting in itself, it is clear that the ultimate goal of HE was to enable computation of any circuit. Several constructions provided partial solutions but it was not until 2009 that Craig Gentry proposed the first fully homomorphic encryption (FHE) scheme. Gentry's strategy consisted in first realizing a Somewhat Homomorphic Encryption (SHE) scheme that enables the (homomorphic) evaluation of low-degree multivariate polynomials. Ciphertexts are embodied with noise, which grows slightly over addition and tremendously over multiplication, which compromises the limits of low-degree polynomials. To solve this problem, Gentry introduced a bootstrapping mechanism with which one can transform a SHE scheme that is able to homomorphically evaluate its own decryption function into a leveled FHE scheme, that is, an encryption scheme that is able to evaluate any circuit up to a predefined depth. The bootstrapping technique produces a “fresh” ciphertext: a ciphertext with an amount of noise equivalent to what it was prior to any homomorphic operation.

Only a few SHE schemes are able to evaluate their own decryption function but also FHE schemes that follow Gentry's blueprint suffer from poor performance. To put things into perspective, the complexity of performing bootstrapping is at least the complexity of decryption multiplied by the bit-length of the individual ciphertexts that are used to encrypt the bits of the secret key. In the context of Gentry's blueprint this is necessary since the SWHE evaluates the decryption function using an encrypted secret key and each bit of the secret key is then replaced by a very large ciphertext that encrypts that bit. To address this problem, Brakerski, Gentry, and Vaikuntanathan introduced two schemes (known as BGV) which are conceived via an entirely new approach, with much better performance than Gentry's original blueprint. This new approach consists in skipping the SWHE step and directly constructing leveled FHE schemes with the possibility of using bootstrapping as an optimization. The BGV scheme, as the vast majority of FHE schemes, is latticed-based and its security is based on some version of the learning with errors (LWE) assumption.

Dijk, Gentry, Halevi, and Vaikuntanathan, when introducing the scheme known as DGHV propose an interesting question: “What is the simplest encryption scheme for which one can hope to achieve security?”. Naturally, the simple will not always be secure so the reconciliation of simplicity and security is undoubtedly a much desired and sometimes hard-to-achieve property. Compared to any lattice-based FHE scheme, DGHV is significantly simpler: very small description with basic modular arithmetic. Similar to Gentry-like constructions, it encrypts individual bits. Unlike lattice-based schemes (which work with vectors and matrices), it operates over the integers. DGHV's security is based on both the single-source-shortest-paths (SSSP) and the approximate greatest common divisor (AGCD) assumption introduced by Howgrave-Graham. Several other contributions were able to improve DGHV's efficiency.

Could a simpler FHE scheme be as secure as the lattice-based ones? A remarkable result by Cheon and Stehle introduces a reduction from LWE to AGCD which is demonstrated by constructing a FHE scheme with security based on the AGCD assumption by deriving the AGCD parameters from the LWE parameters. Among the similarities between DGHV and the scheme proposed by Cheon and Stehle, we remark two facts: 1) they both encrypt bits and 2) they derive a public-key encryption scheme by first describing a private-key encryption scheme and then converted into its public-key counterpart by applying the method introduced by Rothblum, which is based on the fact that any additively homomorphic private-key encryption scheme that is compact can be converted into a public-key encryption scheme. (Informally, a FHE scheme is compact if the size of ciphertexts output by homomorphic evaluations is independent of the number of ciphertexts and/or operations from which it was created.) The combination of these two facts has, at least, the following implication: if γ is the bit length of ciphertexts generated by a FHE scheme with the aforementioned characteristics, for each n-bit message, their corresponding ciphertexts have length nγ. Since, in that kind of encryption scheme, the public key is a r-tuple of ciphertexts encrypting n-bit messages, the length of the public-key is τnγ bits.

1.1 Homomorphic Rational Arithmetic

The need for performing homomorphic operations with rational numbers has been recently investigated. This issue is usually addressed by adding an encoding scheme to the homomorphic encryption scheme so rational numbers can be encoded to, typically, polynomials over some ring. A clever solution was proposed where a technique proposed by Hoffstein and Silverman is combined with the Fan-Vercauteren homomorphic encryption scheme, so a new encryption scheme is derived where rational numbers can be encoded and then used as input. Another interesting solution was proposed where rational numbers are thought as continued fractions and then represented as a sequence of integers. It is not surprising, due to its simplicity, that some form of modular arithmetic is used to encode rational numbers for carrying computation over the integers. Our contribution, at the very least, is distinct in the fact that the encoding of rational numbers into integers is the encryption function itself. Thus, we do not follow the blueprint of using a scheme for encoding rational numbers and another scheme for encrypting and evaluating homomorphic operations. Instead, Hensel codes are employed for both encoding and encryption. Another advantage of our constructions is that we show how to probabilistically encode rational numbers in a structure-preserving way so other homomorphic encryption schemes can use our encoding for performing rational arithmetic.

1.2 Our Contribution

Would it be possible to describe a leveled FHE scheme that conveniently evaluates ciphertexts over the integers and at the same time has a better ciphertext expansion? Would it be possible to work with a public key with length smaller than the length of corresponding ciphertexts? Furthermore, what if we wanted to further expand the message space from bits to not only large integers but also large (positive and negative) rational numbers? Properly expanding the message space of a FHE scheme to a more comprehensive set that includes rational numbers immediately enables the application of homomorphic encryption in scenarios that involve fractional data such as those associated with statistics, finance, machine learning, digital signal processing, among others, without any further need of data formatting. Besides the obvious benefits of such features, not having to format data at the bit level (for accommodating custom message spaces) represents, at the very minimum, less overhead. We believe that a leveled FHE scheme with these desired characteristics requires an approach that is distinct from those employed up to today.

We propose a new approach to construct a leveled FHE scheme that takes messages over a specialized set of rational numbers that can be sufficiently large to contain all rational numbers of interest for any real-world practical application. Our technique allows us to describe a private-key encryption scheme and turn it into a public-key encryption scheme where its public-key has length smaller than the ciphertext it generates. Moreover, both private-key and public-key leveled FHE schemes produce ciphertexts with the same length. We show that the security of our schemes can be clearly mapped to the AGCD assumption while we also introduce the notion of a new hardness assumption, which makes the security analysis clearer and more objective. We showcase a mathematical tool mostly used outside the context of cryptography, which enables our contributions, and we propose its use and further investigation in cryptography.

1.3 Hensel Codes

Between the end of the 19th and the beginning of the 20th centuries, Kurt Hensel introduced the p-adic numbers theory. One of Hensel's main motivations was to relate the ring integers

to the field of rationals

. For our purposes, it suffices to provide a brief discussion of the fundamental idea. If p is prime, any positive integer x can be represented uniquely as an expansion of the form x=a₀+a₁p+a₂p₂+ . . . +a_(n)p^(n), where a_(i) is an integer with 0≤a_(i)<p. In fact, one can similarly expand any rational number x/y by allowing negative powers of p. Such expansions are called p-adic numbers. In the p-adic number system, the elements of

are represented as infinite expansions α=Σ_(−∞) ^(∞)a_(i)p^(i). Applications of p-adic numbers are varied, and include dynamical systems, theoretical physics, algebraic geometry, non-Archemdian analysis, differential calculus, topology, and analytic functions.

Between the 1970s and 1980s, Krishnamurthy, Rao, Subramanian, Alparslan, Hehner and Horspool proposed the use of truncation of p-adic expansions to replace arithmetic operation on rational numbers by the corresponding operations on integers that represent those rational numbers. They named these special integers as Hensel codes and they established the foundation of the theory of Hensel codes (also known as the finite-segment p-adic arithmetic) as a solution to the problem of error-free computation, that is, the computation over approximations of real numbers in such a way that rounding errors do not occur. This property is particularly necessary when working with ill-conditioned problems and numerically unstable algorithms.

Converting rational numbers into Hensel codes is rather trivial, however, the inverse mapping of Hensel codes was for many years an open problem until Gregory identified the required boundaries in absolute value to the numerators and denominators of rational numbers so a Hensel code could be uniquely inverted. Having these boundaries well-defined allowed Miola to propose an efficient algebraic solution for inverting Hensel codes by applying a modified version of the Extended Euclidean Algorithm. Over the years, the theory of Hensel codes expanded to address a variety of areas benefited by error-free computation such as computation of Grobner basis, overflow detection, matrix inversion, fast integer division, parallel computation, solving linear systems of equations, polynomial matrix computations, to cite a few.

Hensel codes can be represented and computed in many forms, from the “dotted” representation to matrices of rational polynomials. In this work we focus on the integer representation of Hensel codes using just the first coefficient of a conventional truncated p-adic expansion. We show that Hensel codes can be p-adic and g-adic (defined via single or multiple primes, respectively) and we expand the original special set of rational numbers to represent as Hensel codes in order to achieve a bijection between those special rational numbers and a finite set of integers reduced modulo a prime or a prime composite.

1.4 General Intuition

We were initially interested in Hensel codes solely for purpose of establishing a bijection between a subset of the rationals and a finite set of integers so we could construct a level FHE scheme with a more comprehensive message space. In the past, the use of Hensel codes for error-free computation was shown to be a more efficient solution in comparison to known alternative. Could Hensel codes still provide advantages for error-free computation nowadays? In 2019, Barillas proposed an efficient machine learning classification approach based on Restricted Boltzmann Machines using Hensel codes. Barillas worked with limited hardware resources since the goal was to provide a solution suitable for embedded devices and classification problems over data containing a small to medium amount of features. Barillas' results over the MNIST dataset outperformed the current state-of-the-art of exact machine learning computations by a factor of 42 in terms of performance, and a factor of 62 in terms of energy efficiency. So, we were encouraged to proceed.

However, we identified an additional opportunity that is enabled by two facts: 1) The mapping we use to establish a connection between a special set of rational numbers and their corresponding Hensel codes has well-defined boundaries which are unique per prime or group of primes. Failure in observing these boundaries will lead to correctness violation. 2) The knowledge of the primes involved in the computation of Hensel codes is required for computing back their corresponding rational numbers. We then created a cryptosystem based on the hardness of inverting Hensel codes without the knowledge of the primes involved in that computation. We do it in such a way that trivial attempts will always violate the boundaries for correctness. Once the primes are unknown, so are the boundaries. This allows us to provide a new asymmetric encryption algorithm based on Hensel codes.

2. Hensel Codes

We now provide a sufficient and self-contained review of the theory of Hensel codes. While we omitted some portions of that theory (for lack of a direct connection with our contributions), we believe that more of the theory can not only be applied in future developments of our research. We hope that this work can motivate further study of Hensel codes as underlying tools for building cryptographic tools.

Error-free computation is a goal that has been long pursued. One way of addressing this problem is via infinite precision integer and rational number arithmetics, which can be very demanding concerning space and time resources. A promising alternative arises from the work of Kurt Hensel, who in 1908 introduced the p-adic number system or p-adic arithmetic, through which one can perform rational arithmetic over the integers. In p-adic number theory, p denotes a fixed prime and each rational number in

is represented by a quantity called p-adic integer, which is a formal series Σ_(i≥0) ^(∞) a_(i) p^(i) with integral coefficients a_(i) satisfying 0≤a_(i)≤p. This quantity can be expressed infinitely or finitely and what is called the finite-segment p-adic arithmetic where we find an opportunity for constructing our scheme. The reader can find detailed introductions to the p-adic number theory.

2.1 Finite-Segment p-adic Arithmetic

For all rational numbers α=a/b there is a n∈Z such that a Hensel code h is given by:

h=a ₀ +a ₁ p+a ₂ p ² + . . . +a _(n-1) p ^(n-1)  Eq. A

where a_(i) is the base p representation of h.

Example A: Let a=2, b=3, p=5, n=5. We compute the Hensel code h as follows:

h=4+1·5+3·5²+1·5³+3·5⁴=2084  Eq. B

In Example A, a₀=4, a₁=1, a₂=3, a₃=1, and a₄=3. In fact, 2084 in base 5 is 31314 (the same a_(i) in reverse order) so it is easy to see that the Hensel code h is the base p representation of a rational number α. In general, a p-adic number is a base p representation (usually via an infinite p-adic expansion) of a rational number. Thus, a Hensel code is a finite p-adic number.

An alternative way to compute h is as follows: given α=a/b, a fixed prime p and some positive n∈

, we have:

h=a·b ⁻¹ mod p ^(n) ,h∈{0, . . . ,p ^(n)−1}  Eq. C

where a, b and p″ must be pairwise coprime.

Example B: Let a=2, b=3, p=5, n=5. We compute the Hensel code h as follows:

h=2·3⁻¹ mod 5⁵=2·1042 mod 3125=2084.  Eq. D

If b is not pairwise coprime with p″, the inverse modulo p″ for b fails to exist, thus we cannot compute h as shown in Example B. A limitation of the second approach to compute h with p^(n) is that all values of b that are multiples of p will fail to have an inverse. However, this is only an issue for n>1. We will then consider the case where n=1 so we can just omit n. We rewrite Eq. C as follows:

h=a· ^(b−1) mod p,h∈{0, . . . ,p−1}  Eq. E

Although Eq. E, which we refer to as the Hensel encode, is a very simple expression, for many years, finding its inverse, that is, the original rational a/b that generated h under p, remained an open problem for many years, until Miola introduced an algebraic solution for what we refer to as the Hensel decode. Miola observed that Gregory developed algorithms for the Hensel encoding and decoding; however, the decoding solution was based on look-up tables, which was inefficient as a general method. Notwithstanding, Miola took into consideration Gregory's unique answer for the Hensel decoding problem would only be possible if the absolute value of both the numerator and denominator of a/b was bounded by some value N. A rational number that would be under that bound was called an order-N Farey fraction. Only then would it be possible to uniquely retrieve a/b from h under p using a slightly modified version of the Extended Euclidean Algorithm (EEA). We use Gregory's method for encoding and Miola's method for decoding; however, we introduce a new definition for the set order-N Farey fractions.

Lemma A1: p/q is a convergent of a/b if:

$\begin{matrix} {{❘{\frac{p}{q} - \frac{a}{b}}❘} \leq {\frac{1}{2q^{2}}.}} & {{Eq}.F} \end{matrix}$

Before discussing our new definition of order-N Farey fractions and Miola's method for Hensel decoding, recall that a convergent of rational number c/d, is another rational number, typically denoted by p_(n)/q_(n), obtained via a limited number of terms in a continued fraction with a total of n convergents where p_(n)/q_(n) is the n-th convergent of c/d. Miola's method finds the original a/b from a Hensel code h under p as a convergent of h/p. This procedure is captured by Theorem 1.

Theorem A: Given a Hensel code h and an odd prime p, a rational number a/b is a convergent of h/p if, by writing h as a Diophantine equation such that h=ab⁻¹ mod p and hb−a≡0 mod p, there is an integer solution for k such that:

hb−a=kp  Eq. G

and the following holds:

$\begin{matrix} {{❘{\frac{h}{p} - \frac{k}{b}}❘} \leq {\frac{1}{b^{2}}.}} & {{Eq}.H} \end{matrix}$

Proof: We start by rewriting h=ab⁻¹ mod p as hb−a ≡0 mod p. Then, in order to prove that −k/b is indeed a convergent of h/p, we rearrange |h−a/b| as a/(bp)=h/p−k/b. Notice that hb−a is congruent to 0 and thus a multiple k of p. Therefore, we can write:

hb−a=kp and a=hb−kp.  Eq. I

So, when we divide both sides by bp we have:

$\begin{matrix} {\frac{a}{bp} = {\frac{h}{p} - {\frac{k}{b}.}}} & {{Eq}.J} \end{matrix}$

Then we just need to check that −k/b is in fact a convergent of h/p since it holds that:

$\begin{matrix} {{{❘{\frac{h}{p^{r}} - \frac{k}{b}}❘} \leq \frac{1}{b^{2}}},} & {{Eq}.K} \end{matrix}$

which can be computed by the EEA (the algorithm that computes all the convergents of any given fraction). So, we know that a/b is computed by the EEA in the form of x_(i)/y_(i) for the i-th term (the first convergent) that satisfies |x_(i)|≤N.

We now introduce Definition A, which depicts Miola's algebraic method for the Hensel decoding.

Definition A: (Hensel decoding) Given an odd prime p, N=|√{square root over (p/2)}|, and a Hensel code h, set x₀=p, x₁=h, y₀=0, y₁=1, and i=1. Then, while x_(i)>N, the following is computed:

q=|x _(i−1) /x _(i)|

x _(i+1) =x _(i−1) −q·x _(i)

y _(i+1) =y _(i−1) −q·y _(i)

i=i+1.  Eq. L

Then, the answer a/b is given by:

c/d=((−1)^(i+1) ·x _(i))/y _(i)  Eq. M

We write this syntax as a/b=H⁻¹ (p, h).

Notice that Eq. L is the actual computation of the convergents of h/p. If the algorithm never enters that loop, then no convergent is computed. If the algorithm enters the loop, it will stop computing the convergents when it finds the first convergent that does not satisfy the inequality x_(i)>N.

Now we have everything we need to introduce the definition of the set of order-N Farey fractions.

Definition B: (Order-N Farey Fractions) The set of order-N Farey fractions

_(N,p), is given by:

$\begin{matrix} {{\mathbb{F}}_{N,p} = {\begin{Bmatrix} {a,b,{c{are}{pairwise}{coprime}},} \\ {{{{a/b} \in {\mathbb{Q}}_{p}}❘{{and}{a/b}{is}{the}{convergent}{of}{}{h/p}v{ia}{EEA}}},} \\ {{0 \leq {❘a❘} \leq N},{{❘b❘} \leq \left\lfloor {{p/N} + 1} \right\rfloor}} \end{Bmatrix}.}} & {{Eq}.N} \end{matrix}$

Now we can define the Hensel encoding using Definition B.

Definition C: (Hensel Encoding) Given an odd prime p and a rational number a/b∈

F_(N,p), a Hensel code h is computed as follows:

h=ab ⁻¹ mod p.  Eq. O

We write this syntax as h=H (p, a/b).

Theorem B: For all a/b∈

_(N,p) and all odd primes p, the following holds:

18H ⁻¹(p,H(a/b))=a/b.  Eq. P

Proof: The elements of the set of order-N Farey fractions are irreducible fractions a/b such that 0≤|a|≤N and 0≤|b|≤└p/(N+1)┘. By Theorem A, we know that the fraction a/b that is encoded as h under p is a convergent of h/p. We also know that the EEA computes all the convergents of h/p. The algorithm for H⁻¹ (p, h) stops computing the convergents when it finds the first fraction that is under the N bound, which is precisely the fraction that originated h.

We can also use multiple primes to represent a rational number, which is referred to as a g-adic expansion of rational numbers, where, given unique odd primes p₁, . . . , p_(k), g is given by g=Π_(i=1) ^(k) p_(i).

There are two ways of encoding an order-N Farey fraction a/b using g-adic numbers. One is to replace p by g such that:

h=H(g,a/b),  Eq. Q

ab=H ⁻¹(g,h).  Eq. R

Since Hensel codes can be computed with p and g, we establish the distinction between the two asp-adic Hensel codes and g-adic Hensel codes.

Theorem C: There is a one-to-one mapping from order-N Farey fractions into g-adic Hensel codes where N=└√{square root over (g/2)}┘ and the set of g-adic Hensel codes is

.

The second way of encoding an order-N Farey fraction a/b using g-adic numbers is by computing a g-adic Hensel code tuple, where each element of the tuple is a p-adic Hensel code for each prime p_(i) in g such that:

(h ₁ , . . . ,h _(k))=H _(g)((p ₁ , . . . ,p _(k)),a/b).  Eq. S

The procedure of Eq. S is captured by Definition D.

Definition D: Given k unique odd primes p₁, . . . , p_(k), N=└√{square root over (g/2)}┘ for g=Π_(i=1) ^(k) p_(i), and a/b∈

_(N,p), g-adic Hensel code is computed as follows:

(h ₁ , . . . ,h _(k))=(H(p ₁ ,a/b), . . . ,H(p _(k) ,a/b)).  Eq. T

We write this syntax as (h₁, . . . , h_(k))=H_(g) ((p₁, . . . , p_(k)), a/b).

Theorem D: For all unique odd primes p₁, . . . , p_(k) and g=Π_(i=1) ^(k) p_(i), there is an isomorphism between g-adic numbers and p-adic numbers.

We decode a g-adic Hensel code tuple in two steps:

1. Transform (h₁, . . . , h_(k)) into h via Chinese Remainder Theorem (CRT); 2. Decode h such that ab=H⁻¹ (g, h).

Definition E: (g-adic Hensel Decode) Given k unique odd primes p₁, . . . , p_(k), g=Π_(i=1) ^(k) p_(i), N=└√{square root over (g/2)}┘, and a g-adic Hensel code tuple (h₁, . . . , h_(k)), the corresponding order-N Farey fraction is given by:

$\begin{matrix} {{h = {\sum_{i = 1}^{k}{\frac{g}{p_{i}}\left( {\left( \frac{g}{p_{i}} \right)^{- 1}{mod}\ p_{i}} \right)h_{i}{mod}\ g}}},} & {{Eq}.U} \end{matrix}$ $\begin{matrix} {{a/b} = {{H^{- 1}\left( {g,h} \right)}.}} & {{Eq}.V} \end{matrix}$

We write this syntax as a/b=H_(g) ⁻¹((p₁, . . . , p_(k)), (h₁, . . . , h_(k))).

2.2 Hensel Codes and the Extended Euclidean Algorithm

It was shown by R. T. Gregory that there is a one-to-one mapping from the so-called order-N Farey fractions

_(N) :={x/y||x|≤N,0<|y|≤N},N=└√{square root over ((p−1)/2)}┘

to the finite field

_(p), given via the mapping x/y→xy⁻¹(mod p). The major drawback of the order-N Farey fractions is that they only correspond to a subset of

_(P). We will use a modification of the Extended Euclidean algorithm (EEA) to enlarge

to a set whose elements are in bijective correspondence with the elements of

_(P). In particular, we construct a factor ring (isomorphic to the finite field of order p) from a subring of the rationals

and then use the to-be-defined modification of the EEA to select one representative fraction from each coset of the factor ring. To this end, fix an odd prime p, and recall that the set {a/b|gcd(p, b)=1} can be realized as the localization of the integers Z at the prime ideal (p). We will denote this ring by

_((p)). Since gcd(p, b)=1 guarantees that b⁻¹ exists in

_(p), we can define the map H_(p):

_((p))→

_(P) by a/b→ab⁻¹(mod p). It is easy to verify that this map is a surjective ring homomorphism. Consequently, we obtain an isomorphism

_((p))/ker (H_(p))≅

_(p). There are many ways to select representatives from the cosets of

_((p))/ker (H_(p)), but we will make our selection to guarantee that the set of representatives contains

_(N).

Recall that the Extended Euclidean Algorithm (EEA) calculates the greatest common divisor of two integers x₀, x₁ along with the associated Bezout coefficients. The computation generates the tuples (x₂, . . . , x_(n)), (y₂, . . . , y_(n)), (z₂, . . . , z_(n)), and =└x_(i−1)−1/x_(i)┘ such that:

x _(i+1) =x _(i−1) −q _(i) x _(i), where x ₀ ,x ₁ are the input,

y _(i+1) =y _(i−1) −q _(i) y _(i), with y ₀=1,y ₁=0,

z _(i+1) =z _(i−1) −q _(i) z _(i), with z ₀=0,z ₁=0.

Moreover, for each i≤n, we have y_(i)x₁+z_(i)x₀=x_(i). The computation stops with x_(n)=0, at which point x_(n-1)=gcd(x₀, x₁). We define a modified version of this algorithm, as follows:

Definition 1 (Modified Extended Euclidean Algorithm). Let g be a product of distinct odd primes, h∈

, and N=└√{square root over ((g−1)/2)}┘. Run EEA with x₀=g and x₁=h. Once |x_(i)|≤N, output (x, y)=((−1)^(i+1)x_(i), (−1)^(i+1)y_(i)). We write this as MEEA(g, h)=(x, y). Observe that there is an integer z (namely, (−1)^(i+1)z_(i)) such that yh+zg=x.

Lemma 1. Let g be a product of distinct, odd primes, N=└√{square root over ((g−1)/2)}┘, and h, h′∈

_(g). The following hold:

-   -   (i) If MEEA(g, h)=(x, y), then |x|≤N and |y|≤2N.     -   (ii) Let p be prime, MEEA(p, h)=(x, y), and MEEA(p, α)=(x′, y′).         α=h(mod p) if and only if x=x′ and y′=y (mod p).     -   (iii) MEEA(g, h)=(0,⋅) if and only if gcd(g, h)>N or h=0.

Proof

-   -   (i) Suppose MEEA(g, h)=((−1)^(i+1)x_(i), (−1)^(i+1)y_(i)). That         |x|≤N is immediate from the stopping condition in MEEA. The         outputs of the EEA satisfy:

${{❘y_{k}❘} \leq \frac{x_{0}}{x_{k - 1}}},{{for}{all}{k.}}$

By definition, x_(i−1)>N. Whence, N′=√{square root over ((g−1)/2)},

${{❘y_{i}❘} \leq \frac{g}{x_{i - 1}} < \frac{g}{N^{\prime}} < \frac{{2\left( N^{\prime} \right)^{2}} + 1}{N^{\prime}}} = {{2N^{\prime}} + {\frac{1}{N^{\prime}}.}}$

It follows that

${{{❘y_{i}❘} \leq \left\lfloor {{2N^{\prime}} + \frac{1}{N^{\prime}}} \right\rfloor} = {2N}},$

proving 1.

-   -   (ii) By hypothesis, there is an integer k such that α=h+kg.         Suppose that α≠h (i.e., at least one of h,k is nonzero). Apply         the EEA in two cases: (1) x₀=p, x₁=h, and (2) x₀=p, x₁=h+kp.         After three iterations of (2), one observes that the values of         x_(i) match those obtained after one iteration of (1). Moreover,         MEEA applied to (1) and (2), respectively, will not terminate         before the values of x_(i) match. This proves x=x′. The above,         in conjunction with yh+zp=x and y′α+z′p=x′, yields yh=y′α. Then         yh−y′h=y′kp, and so y′h=yh (mod p). Since gcd(g, h)=1, y′=y(mod         p). The converse follows easily.     -   (iii) Suppose gcd(g, h)>N. Recall that the EEA with x₀=g and         x₁=h terminates when x_(n)=0, at which point x_(n-1)=gcd (g, h).         Item 3 then follows from the stopping condition in MEEA.         Conversely, if MEEA(g, h)=(0,⋅), then gcd(g, h)>N. For if not,         then MEEA(g, h)=((−1)^(i+1)x_(i),⋅), where i≤n−1, a         contradiction.

Definition 2 (Order-(N,p) Farey Fractions). Let p be an odd prime and N=└√{square root over ((p−1)/2)}┘. We define the set of order-(N, p) Farey fractions as:

${\mathbb{F}}_{N,p}:={\left\{ {{\frac{x}{y}:{\exists{h \in {{\mathbb{Z}}_{p}{s.t.{\ }{{MEEA}\left( {p,h} \right)}}}}}} = \left( {x,y} \right)} \right\}.}$

Throughout the paper, we will consider

_(N,p) with the familiar addition and multiplication on

. Note that

_(N,p) is not closed under these operations. The following lemma collects some important facts about

_(N,p).

Proposition 1. Let p be an odd prime and N=└√{square root over ((p−1)/2)}┘.

-   -   (i)         _(N)⊂         _(N,p).     -   (ii) If x/y∈         _(N,p), then |x|≤N and |y|≤2N.     -   (iii) The elements of         _(N,p) are in lowest terms.     -   (iv) Distinct elements of         _(N,p) lie in distinct cosets of         _((p))/ker (H_(p)).     -   (v) H_(p):         _(N,p)→         _(p) is a bijection.

Proof

-   -   (i) Let x/y∈         _(N) such that h=xy⁻¹ (mod p), and say MEEA(p, h)=(x_(i),         y_(i)). By construction, x_(i)≤N and x_(j)>N for all j<i. As         shown by Kornerup, implementing EEA with x₀=p and x₁=h will         yield x_(k)/y_(k)=x/y for some k. Now, suppose that |y_(i)|>N.         One easily verifies inductively |y_(j)|≤|y_(j+1)| and         x_(j)>x_(j+1) for all j. Whence for all i, either x_(i)>N or         |y_(i)|>N, contradicting x_(k)/y_(k)∈         _(N). Thus |y_(i)|>N, and x_(i)/y_(i)∈         _(N). Finally, since x_(i)y_(i) ⁻¹(mod p)=xy⁻¹(mod p)=h, and         representations of elements of         _(N) in         _(p) are unique, we conclude that x_(i)/y_(i)=x/y. This shows         that x/y∈         _(N,p).     -   (ii) Use Lemma 1 with g=p.     -   (iii) MEEA(p, 0)=(0,⋅), so let h∈         _(p) be nonzero and MEEA(p, h)=(x, y). By definition there is an         integer z (output by EEA) such that x=yh+zp. Further, properties         of greatest common divisors yield:

gcd(zp,y)=gcd(yh+zp,y)=gcd(zp,y).

By (ii), 0<|y|<p, we deduce Lemma 1(iii), that 0<|z|<p. Consequently,

gcd(zp,y)=gcd(z,y)·gcd(p,y)=gcd(z,y).

Now, gcd(z, y)=1, which proves (iii).

-   -   (iv) First, notice that (ii) implies         _(N,p)⊂         _((p)). Let x/y, x′/y′∈         _(N,p) be distinct. Necessarily, H_(p)(x/y)≠H_(p)(x′/y′). Since         H_(p) is a homomorphism, then H_(p)(x/y−x′/y′)≠0, which implies         x/y and x′/y′ lie in distinct cosets.     -   (v) The result follows immediately from (iv) and the isomorphism         _((p))/ker (H_(p))≅         _(p).

We may now define the mapping that allows us to recover an element of

_(N,p) given an arbitrary integer.

Definition 3. Let p be prime and h∈

. Define:

$\begin{matrix} {{H_{p}^{- 1}:\left. {\mathbb{Z}}\rightarrow{{\mathbb{F}}_{N,p}{by}h}\rightarrow\frac{x}{y{mod}\ p} \right.},} & {{Eq}.1} \end{matrix}$

where MEEA (p, h)=(x, y).

Remark 1. Lemma 1(ii) guarantees that the output x/y (mod p) from the preceding definition is in

_(N,p). Moreover, by the definition of the order-(N, p) Farey fractions, H_(p) ⁻¹ is surjective.

Proposition 2. If x/y∈

_(N,p) and h∈

_(p), then H_(p) ⁻¹(H_(p)(x/y))=x/y and H_(p)(H_(p) ⁻¹(h))=h.

Proof Obvious.

The following results establish the compatibility of H_(p) ⁻¹ with arbitrary arithmetic circuits. For simplicity, we represent a circuit by the multivariate polynomial which it computes.

Lemma 2. Let h₁, . . . , h_(k) ∈

. If P is a polynomial in k variables over

which takes rational arguments, and H_(p) ⁻¹(P(h₁, . . . , h_(k)))=a/b, then:

${H_{p}\left( {P\ \left( {{H_{p}^{- 1}\left( h_{1} \right)},\ldots,{H_{p}^{- 1}\left( h_{k} \right)}} \right)} \right)} = {{H_{p}\left( \frac{a}{b} \right)}.}$

Proof Suppose H_(p) ⁻¹(h_(i))=x_(i)/y_(i). Certainly x_(i)y_(i) ⁻¹=h_(i)(mod p), whence

P(H _(p) ⁻¹(h ₁), . . . ,H _(p) ⁻¹(h _(k)))=P(h ₁ , . . . ,h _(k))(mod p).

The result follows, since P(h₁, . . . , h_(k))=ab⁻¹(mod p).

Proposition 3. If h₁, . . . , h_(k)∈

and P is a polynomial in k variables over

which takes rational arguments, then:

H _(p) ⁻¹(P(h ₁ , . . . ,h _(k)))=H _(p) ⁻¹(H _(p)(P(H _(p) ⁻¹(h ₁), . . . ,H _(p) ⁻¹(h _(k))))).

Proof Since

_(N,p) is not closed under addition and multiplication then

=P(H _(p) ⁻¹(h ₁), . . . ,H _(p) ⁻¹(h _(k)))

need not be an element of

_(N,p). However, by Lemma 3,

and H_(p) ⁻¹((h₁, . . . , h_(k))) lie in the same coset (are equivalent modulo p). Consequently, H_(p) ⁻¹(H_(p)(

))=H_(p) ⁻¹(P(h₁, . . . , h_(k))).

We now present the remaining maps which are fundamental to our scheme.

Definition 4. Let g=p₁, . . . , p_(k) be a product of at least two distinct primes. Define maps:

$H_{g}:\left. {\mathbb{Q}}\rightarrow{{\mathbb{Z}}_{g}{by}\frac{x}{y}}\rightarrow\left\{ \begin{matrix} {{{xy}^{- 1}\left( {{mod}g} \right)},} & {{{if}{\gcd\left( {g,y} \right)}} = 1} \\ {0,} & {{{if}\gcd\left( {g,y} \right)} \neq 1} \end{matrix} \right. \right.$ ${{\overset{\sim}{H}}_{g}^{- 1}:\left. {\mathbb{Z}}\rightarrow{{\mathbb{Q}}{by}h}\rightarrow\frac{x}{y{mod}\ g} \right.},{{{where}{{MEEA}\left( {g,h} \right)}} = {\left( {x,y} \right).}}$

Remark 2. If n is an integer, then H_(g)(n)=n (mod g).

Remark 3. We write “{tilde over (H)}_(g) ⁻¹(⋅)” instead of “H_(g) ⁻¹(⋅)” because {tilde over (H)}_(g) ⁻¹ is not the inverse of H_(g) when g is composite. This is because if {tilde over (H)}_(g) ⁻¹(h)=x/y we may have y|g, in which case y Text is not invertible modulo g, and so (provided x≠0) H_(g) ({tilde over (H)}_(g) ⁻¹(x))=0≠x/y.

Recall that the Chinese Remainder Theorem (CRT) simply describes an isomorphism

_(p) ₁ × . . . ×

_(p) _(k) ≅

_(p) ₁ _(. . . p) _(k) . The image of (h₁, . . . , h_(k)) under this isomorphism will be denoted by h=CRT_(p) ₁ _(, . . . , p) _(k) (h₁, . . . , h_(k)).

Henceforth, for primes p₁, . . . , p_(k) and h₁, . . . , h_(k)∈

, we will denote:

{tilde over (H)} _(p) ₁ _(. . . p) _(k) ⁻¹(CRT _(p) ₁ _(, . . . ,p) _(k) (h ₁ , . . . ,h _(k)))

by {tilde over (H)}_(p) ₁ _(, . . . p) _(k) ⁻¹(h₁, . . . , h_(k)).

Lemma 3. Let g=p₁, . . . , p_(k) be a product of distinct primes. If H_(g) (x/y)≠0, then H_(g)(x/y)=H_(p) _(i) (x/y)(mod p_(i)).

Proof. To avoid confusion, we will denote the (multiplicative) inverse of y modulo n by y_(n) ⁻¹. If h=H_(g)(x/y)≠0, then y is invertible modulo p_(i) for each i. Put h_(i)=H_(p) _(i) (x/y). By definition, h=xy_(g) ⁻¹(mod g) and h_(i)=xy_(p) _(i) ⁻¹ (mod p_(i)) for all i. Multiplying both sides of each congruence by y yields hy=x(mod g) and x=h_(i)y(mod p_(i)). It follows that hy=h_(i)y (mod p_(i)) for all i. Finally, since y is invertible modulo each p_(i), h=h_(i)(mod p_(i)).

Proposition 4. If g=p₁, . . . , p_(k) is a product of distinct primes, H_(g)(x/y)≠0, and x/Y∈

_(N,p) _(i) , then H_(p) _(i) ⁻¹(H_(g)(x/y))=x/y.

Proof By Lemma 1(ii), Lemma 3, and the definition of H_(p) _(i) ⁻¹, we see that:

H _(p) _(i) ⁻¹(H _(g)(x/y))=H _(p) _(i) ⁻¹(H _(p) _(i) (x/y)).

The result then follows from Lemma 2.

Lemma 4. If g is a product of distinct primes and g|n, then {tilde over (H)}_(g) ⁻¹(n)=0.

Proof Observe that gcd(g, n)=g>[√{square root over ((g−1)/2)}]. The result then follows from Lemma 1(iii).

3. The AGCD Problem

Informally, the AGCD problem is defined as follows: given polynomially many samples of the form x=r+qp for a randomly chosen odd prime p, find p. Since, in the remainder of this paper we will refer to known (ρ, η, γ) AGCD parameters, a formal definition of the AGCD problem is reproduced below.

Definition 5. (AGCD). Let p, X≥1, and ϕ a distribution over

. We define A_(X,ϕ) ^(AGCD) (p) as the distribution over

obtained by sampling

$\left. q\leftarrow{{\mathbb{Z}}{\cap\left\lbrack {0,\frac{x}{p}} \right.}} \right)$

and r←ϕ, and returning x=qp+r.

Let

be a distribution over

∩[0,X). AGCD_(X,φ)(

) consists in distinguishing, given arbitrarily many independent samples, between the uniform distribution over

∩[0,X) and the distribution A_(X,φ) ^(AGCD)(p) for p←

. We use the notation AGCD_(X,φ)(

) to emphasize the number of samples m used by the eventual distinguisher. We say that an algorithm

is an (∈₁, ∈₂)-distinguisher for AGCD_(X,ϕ)(

) if, with probability ≥∈₂ over the choice of p←

, its distinguishing advantage between A_(X,ϕ)(p) and U(

∩[0, X)) is ≥∈₁.

For ρ, η, γ≥1, the (ρ, η, γ)-AGCD problem is AGCD_(2γ,ϕ)(

) with

the uniform distribution over η-bit prime integers and ϕ the uniform distribution over

∩(−2^(ρ), 2^(ρ)).

Cheon and Stehle discuss a reduction from the Learning With Errors (LWE) problem to a variant of the AGCD where such search variant consists in finding the unknown p while also introducing a reduction from the search variant to the decision variant. They arrive at a set of secure AGCD parameters via reduction of a LWE instance. For appreciating this reduction, we refer the reader to since we shall not repeat that discussion in this work. Instead, we will use the proposed AGCD parameters.

3.1 Recommended AGCD Parameters

We let ρ denote the size of the noise, η denote the size of the secret greatest common divisor, and γ denote the size of an AGCD sample. Cheon and Stehle note that for the AGCD problem to be potentially hard, the parameters must satisfy the following: ρ≥λ in order to prevent brute force attacks on the noise, η>ρ, and γ≥Ω((λ/log λ)(η−φ²) in order to prevent lattice reduction attacks on AGCD such as orthogonal lattice attacks, as well as the Lagarias' simultaneous Diophantine approximation attack, and the Cohn-Heninger attack.

4. A Private-Key Leveled FHE Scheme

Now we introduce a private-key leveled FHE scheme based on Hensel codes. Our motivation is to provide a basic blueprint for a leveled FHE scheme with Hensel codes and then use it as the foundation of a public-key leveled FHE scheme by only applying an asymmetric property we have with Hensel codes. The reader can see this private encryption scheme as first step towards its public-key counterpart, which is the candidate scheme we want to highlight. For this reason, we will concentrate the discussions about correctness, security, and practical implications on the public-key version.

Given a parameter and the parameter d, define ρ, η, γ, and μ as follows: ρ=λ, η=2(d+2)λ, μ=γ−η−2λ, and

${\gamma = {\frac{\lambda}{\log_{2}(\lambda)}\left( {\eta - \rho} \right)^{2}}}.$

The encryption scheme is then given by:

-   -   Gen takes λ and d as inputs and generates uniform primes p₁, . .         . , p₅ such that

❘p₁❘_(bits) = ρ + 1, ${{❘p_{2}❘}_{bits} = {\left| p_{3} \right|_{bits} = \frac{\rho}{2}}},$ ❘p₄❘_(bits) = η, ❘p₅❘_(bits) = μ.

-   -    We set private secret key sk=(p₁, p₂, p₃, p₄) and public         evaluation key evk=g=Π_(i=1) ⁵p_(i). Note that |g|_(bits)=γ. The         message space is defined as         =         _(N,p) ₁ . We write the syntax as (sk, evk)←Gen(1^(λ), 1^(d)).     -   Enc takes a message m∈         and sk, evk as inputs, generates uniform and independent s₁←         ₂ _(λ-1) , s₂←         _(p) ₂ , s₃←         _(p) ₃ , and δ←         _(g/p) ₄ , and then computes c=|H_(g)(s₁·{tilde over (H)}_(p) ₁         _(,p) ₂ _(,p) ₃ ⁻¹(0, s₂, s₃)+δ_(p) ₄ )|_(g). We write this as         c←Enc_(sk,evk)(m).     -   Dec takes c and sk as inputs and computes m=H_(p) ₁ ⁻¹(H_(p) ₁         (H_(p) ₄ ⁻¹(c))). We write this as m=Dec_(sk) (c).     -   Addition and multiplication of ciphertexts are computed in the         natural way over the integers modulo g.

Remark 4. In the encryption algorithm, let x/y={tilde over (H)}_(p) ₁ _(,p) ₂ _(,p) ₃ ⁻¹(0, s₂, s₃). Then, x/y is a rational encoding of zero, and so is s₁·x/y. Moreover, setting |p₁|_(bits)=ρ+1 implies p₁>2└√{square root over ((p₁p₂p₃−1)/2)}┘, which guarantees (by Lemma 2.5(ii)) that gcd(p₁, y)=1, so H_(p) ₁ (x/y) is defined.

Remark 5. In the decryption algorithm, for all c output by Enc, with high probability, it holds that H_(p) ₄ ⁻¹(c)∉

_(N,p) ₁ . We address this issue by computing H_(p) ₁ (H_(p) ₄ ⁻¹(c)) which gives as a Hensel code in

_(p) ₁ . Then, we can just decode that Hensel code using p₁, which gives us the expression in the decryption algorithm, so we obtain the desired member of

_(N,p) ₁ .

5. A Public-Key Leveled FHE Scheme

Now we introduce a public-key leveled FHE scheme that is similar to the previously described private-key encryption with the exception that we now explore asymmetric Hensel “encodings.” The parameters we use are conservative. The reason for employing a more conservative parameter definition is due to the fact that the ciphertext expansion of our construction is significantly more efficient than any leveled FHE construction where the message space is defined as {0, 1}. At the same time, we know there are room for optimizations which can further improve the already encouraging runtime results presented in Section 7.1. Given a parameter and the parameter d, define η, γ, and μ as follows:

ρ=λ,η=dλ,μ=d ²λ log₂(λ)−η−2λ−3,γ=2η+(3λ)/2+μ+3.  Eq. 2

-   -   Gen takes 1^(λ) and 1^(d) as input and generates uniform and         independent odd primes p₁, p₂, p₃, and p′₄ such that         |p₁|_(bits)=λ, |p₂|_(bits)=λ+3, |p₃|_(bits)=η, |p′₄|_(bits)=η,         |p₅|_(bits)=μ, so we compute p₄=(p′₄)^(μ/η+1). Let g=p₁ . . . p₄         and g′=p₃p₄. For t←         ₂ _(λ-1) and δ_(e)←         ₂ _(λ-η) , we compute:

e=H _(g)(H _(p) ₃ ({tilde over (H)} _(p) ₁ _(,p) ₂ ⁻¹(0,t))+δ_(e) p ₃).  Eq. 3

-   -   The public key is pk=(e, g′, evk=g) and the secret key is         sk=(p₁, p₃).     -   Enc encrypts a message m∈         _(N,p) ₁ by choosing s₁, s₂∂         ₂ _(λ-η) and δ←[p₁p₂, p₁p₂p₄)∪         and then computing:

c←Enc _(pk,evk)(m)=H _(g)(H _(g′)(s ₁ e+m)+s ₂ g′+((g′)²)  Eq. 4

-   -   Dec takes a ciphertext c as input and computes m as follows:

m=Dec _(sk,pk)(c)=H _(p) ₁ ⁻¹(H _(p) ₁ (H _(p) ₃ ⁻¹(c))).  Eq. 5

-   -   Addition and multiplication of ciphertexts are computed in the         natural way over the integers modulo g.

Remark 6. The constant e in the public key should never equal δ_(e)p₃, else an adversary trivially computes gcd(e, g′)=p₃ which compromises the secret key. To this end, recall that {tilde over (H)}_(p) ₁ _(,p) ₂ ⁻¹(0, t)={tilde over (H)}_(p) ₁ _(,p) ₂ ⁻¹(h), where h=CRT_(p) ₁ _(,p) ₂ (0, t). Since t≠0, h≠0 and gcd(h, p₁p₂)=p₁. Lemma 1(iii) then implies that {tilde over (H)}_(p) ₁ _(p) ₂ ⁻¹(h)≠0 as long as p₁<└√{square root over ((p₁p₂−1)/2)}┘. This is guaranteed since |p₁|_(bits)=λ and |└√{square root over ((p₁p₂−1)/2)}┘∥_(bits)>λ.

5.1 Correctness

Here we continue with the previously-adopted convention of using multivariate polynomials instead of arithmetic circuits.

Definition 6. Let

_(k,n)⊂

└x₁, . . . , x_(k)┘ be the family of polynomials of the form

(x₁, . . . , x_(k))=y₁*y₂* . . . * y_(n), where y_(i)∈{x₁, . . . , x_(k)} and * is either + or x.

Proof. If P∈

_(k,n) has i≤n−1 additions, then the numerator of x is the sum of i+1 monomials, each being a product of the a_(i), b_(j). Moreover, the denominator y is simply a product of n (not necessarily distinct) of the b_(j). Note that for each monomial m summand of x satisfies: m/y is a product (possibly with repeated factors) of some number of the a_(i)/b_(i). It follows that each monomial in the numerator is a product of at most n of the a_(j), b_(j). For if there is a monomial m with more than n factors, then m/y reduces to a fraction with more factors (the a_(i), b_(j)) in the numerator than the denominator. Such a fraction cannot satisfy the above note, and so a contradiction is obtained. Now, since |a_(i)|, |b_(j)|≤α, we see that the denominator y and the monomial summands of x all have absolute value at most α^(n). The result then follows since x has at most n monomial summands.

Theorem 1 (Correctness). For all sk, pk, and evk output by Gen and all m∈

_(N,p) ₁ ,

Dec _(sk,pk)(Enc _(pk,evk)(m)m.  Eq. 6

Let P∈

_(p) ₁ _(,D), m₁, . . . , m_(k)∈

_(N,p) ₁ and c_(i)←Enc_(pk,evk)(m_(i)). If P(m₁, . . . , m_(k))∈

_(N,p) ₁ , d≤λ, and D≤(d/5)−1, then:

Dec _(sk,pk)(P(c ₁ , . . . ,c _(k)))=P(m ₁ , . . . ,m _(t)).  Eq. 7

Proof Let m∈

_(N,p) ₁ , and suppose c=Enc_(pk, evk)(m). By construction,

c=H _(g)(H _(g′)(se+m)+s ₂ g′δ(g′)²)=H _(g′)(se+m)+αp ₃,α∈

,

where e=H_(g)(H_(p) ₃ ({tilde over (H)}_(p) ₁ _(,p) ₂ ⁻¹(0, t)+δ_(e)p₃)) and s∈

_(p) ₁ .

Proceeding with Dec (which computes H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₃ ⁻¹(c))) and applying Proposition 2 and Proposition 3, we obtain:

$\begin{matrix} {{{H_{p_{3}}^{- 1}(c)} = {H_{p_{3}}^{- 1}\left( {{H_{g^{\prime}}\left( {{se} + m} \right)} + {\alpha p_{3}}} \right)}},{{{for}{some}\alpha} \in {\mathbb{Z}}}} \\ {= {H_{p_{3}}^{- 1}\left( {H_{p_{3}}\left( {{H_{p_{3}}^{- 1}\left( {H_{g^{\prime}}\left( {{se} + m} \right)} \right)} + {H_{p_{3}}^{- 1}\left( {\alpha p_{3}} \right)}} \right)} \right)}} \\ {= {H_{p_{3}}^{- 1}\left( {H_{p_{3}}\left( {H_{p_{3}}^{- 1}\left( {H_{g^{\prime}}\left( {{se} + m} \right)} \right)} \right)} \right)}} \\ {= {H_{p_{3}}^{- 1}\left( {H_{g^{\prime}}\left( {{se} + m} \right)} \right)}} \end{matrix}$

Put x/y={tilde over (H)}_(p) ₁ _(,p) ₂ ⁻¹(0, t) and N=└√{square root over ((p₃−1)/2)}┘. We note that |s|_(bits)≤λ, and deduce from Lemma 1(i) that |x|_(bits)≤λ+1 and |y|_(bits)≤λ+2. Further, since (dλ−2)/2≤|N|_(bits)(for d≥5), we see that |sx|_(bits), |y|_(bits)≤|N|_(bits). Consequently sx/y∈

_(N) ⊂

_(N,p) ₃ . Now, through repeated applications of the above observation, Lemma 1(iii), Proposition 3, and Lemma 4, we obtain:

${H_{p_{3}}^{- 1}\left( {H_{g^{\prime}}\left( {{se} + m} \right)} \right)} = {{H_{p_{3}}^{- 1}\left( {H_{p_{3}}\left( {\frac{sx}{y} + m} \right)} \right)}.}$

By comparing bit lengths (as above), we find that sx/y+m∈

_(N,p) ₃ (this time, as long as d≥6). Thus, H_(p) ₃ ⁻¹(c)=sx/y+m.

Lastly, we compute:

${{H_{p_{1}}^{- 1}\left( {H_{p_{1}}\left( {\frac{sx}{y} + m} \right)} \right)} = {H_{p_{1}}^{- 1}\left( {{H_{p_{1}}\left( \frac{sx}{y} \right)} + {H_{p_{1}}(m)} - {kp_{1}}} \right)}},{k \in {\left\{ {0,1} \right\}.}}$

Since H_(p) ₁ is a ring homomorphism and s∈

₂ _(λ-1) ⊂

_(p) ₁ , we have H_(p) ₁ (sx/y)=H_(p) ₁ (s)H_(p) ₁ (sx/y)(mod p₁)=sH_(p) ₁ (sx/y)−np₁ for some n∈

. Moreover, H_(p) ₁ (x/y)=0 by construction.

Whence,

${{H_{p_{1}}^{- 1}\left( {H_{p_{1}}\left( {\frac{sx}{y} + m} \right)} \right)} = {H_{p_{1}}^{- 1}\left( {{H_{p_{1}}(m)} - {\left( {k + n} \right)p_{1}}} \right)}}.$

With a final application of Proposition 3 and Lemma 4, the above simplifies to H_(p) ₁ ⁻¹(H_(p) ₁ (m))=m. Thus Eq. 6 is established.

We now show that the scheme is compatible with homomorphic operations. Let c₁, . . . , c_(k)∈

_(g) be ciphertexts with corresponding messages m_(i)∈

_(N,p) ₁ , and P∈

_(k,D). Then, as above, there are s_(i)∈

₂ _(λ-1) and an integer α′ such that for each i, c_(i)=H_(g′)(s_(i)e+m_(i))+α′g′. Suppose further that P(m₁, . . . , m_(k))∈

_(N,p) ₁ . Proceeding as in the proof of (6), we compute:

$\begin{matrix} {{H_{p_{3}}^{- 1}\left( {P\left( {c_{1},\ldots,c_{k}} \right)} \right)} = {H_{p_{3}}^{- 1}\left( {P\left( {{H_{g^{\prime}}\left( {{s_{1}e} + m_{1}} \right)}\ ,\ldots,{H_{g^{\prime}}\left( {{s_{k}e} + m_{k}} \right)}} \right)} \right)}} \\ {= {H_{p_{3}}^{- 1}\left( {H_{p_{3}}\left( {P\left( {{H_{p_{3}}^{- 1}\left( {H_{g^{\prime}}\left( {{s_{1}e} + m_{1}} \right)} \right)}\ ,\ldots,{H_{p_{3}}^{- 1}\left( {H_{g^{\prime}}\left( {{s_{k}e} + m_{k}} \right)} \right)}} \right)} \right)} \right)}} \\ {= {{H_{p_{3}}^{- 1}\left( {H_{p_{3}}\left( {P\left( {{{s_{1}\frac{x}{y}} + m_{1}},\ldots,{{s_{k}\frac{x}{y}} + m_{k}}} \right)} \right)} \right)}.}} \end{matrix}$

Now, let x_(i)/y_(i)=s_(i)x/y+m_(i) and x*/y*=P(x₁/y₁, . . . , x_(k)/y_(k)). We will show that x*/y*∈

_(N,p) ₁ . Recall that |s_(i)|_(bits)≤λ, |x_(i)|_(bits)≤λ+1 and |y_(i)|_(bits)≤λ+2.

It follows that |x_(i)|_(bits)≤(5λ+3)/2 and |y_(i)|_(bits)≤(3λ+3)/2. For simplicity, we take (5λ+3)/2 as the bound for bit length for both x_(i) and y_(i).

By invoking Lemma 5, and the binary logarithm (to count bit lengths), we have:

${❘x^{*}❘}_{bits},{{❘y^{*}❘}_{bits} \leq {{\log_{2}(D)} + {D\left( \frac{{5\lambda} + 3}{2} \right)} + {1.}}}$

Now, recalling that |└√{square root over ((p₃−1)/2)}┘|_(bits), we see that:

${{\log_{2}(D)} + {D\left( \frac{{5\lambda} + 3}{2} \right)} + 1} \leq \frac{{d\lambda} - 2}{2}$

is a sufficient condition to guarantee that x*/y*∈

_(N), where N=└√{square root over ((p₃−1)/2)}┘. Easy algebraic manipulations verify that the above inequality reduces to:

$\frac{{\log_{2}\left( D^{2} \right)} + {3D} + 3}{d - {5D}} \leq {\lambda.}$

The hypotheses that d≤λ and D≤(d/5)−1 guarantees that the above inequality is true. Whence, x*/y*∈

_(N)⊂

_(N,p) ₃ , and

${H_{p_{3}}^{- 1}\left( {P\left( {c_{1},\ldots,c_{k}} \right)} \right)} = {\frac{x^{\star}}{y^{\star}} = {{P\left( {\frac{x_{1}}{y_{1}},\ldots,\ \frac{x_{k}}{y_{k}}} \right)}.}}$

All that remains is to compute H_(p) ₁ ⁻¹(H_(p) ₁ (x*/y*)). To this end, observe that since H_(p) ₁ is a homomorphism under addition and multiplication modulo p₁, H_(p) ₁ (x_(i)/y_(i))=H_(p) ₁ (s_(i)x/y)+H_(p) ₁ (m_(i))−α_(i)p₁=H_(p) ₁ (m_(i))−α_(i)p₁, and H_(p) ₁ (P(x₁/y₁, . . . , x_(k)/y_(k)))=H_(p) ₁ (P(H_(p) ₁ (x₁/y₁), . . . , H_(p) ₁ (x_(k)/y_(k))))−αp₁, where α, α_(i)∈

. Now, by the preceding observations and Proposition 3, we obtain:

$\begin{matrix} {{H_{p_{1}}^{- 1}\left( {H_{p_{1}}\left( \frac{x^{\star}}{y^{\star}} \right)} \right)} = {H_{p_{1}}^{- 1}\left( {{P\left( {{{H_{p_{1}}\left( m_{1} \right)} - {\alpha_{1}p_{1}}},\ldots,{{H_{p_{1}}\left( m_{k} \right)} - {\alpha_{k}p_{1}}}} \right)} - {\alpha p_{1}}} \right)}} \\ {= {{H_{p_{1}}^{- 1}\left( {H_{p_{1}}\left( {P\left( {m_{1},\ldots,m_{k}} \right)} \right)} \right)}.}} \end{matrix}$

Finally, since P(m₁, . . . , m_(k))∈

_(N,p) ₁ ,

H _(p) ₁ ⁻¹(H _(p) ₁ (P(m ₁ , . . . ,m _(k))))=P(m ₁ , . . . ,m _(k)).

This completes the proof of Eq. 7,

Remark 7. The set

_(p) ₁ _(,D)=└(d/5)−1┘, does not contain all polynomials with which our scheme is compatible. In particular, we note that for any polynomial

taking rational arguments: if Q(m₁, . . . , m_(k))∈

_(N,p) ₁ and Q(s₁x/y+m₁, . . . , s_(k)x/y+m_(k))∈

F_(N,p) ₃ , then Dec_(sk,pk)(Q(c₁, . . . , c_(k)))=Q(m₁, . . . , m_(t)).

Remark 8. The requirement that P(m₁, . . . , m_(k))∈

_(N,p) ₁ may seem unreasonable since

_(N,p) ₁ is not closed under addition. However, one can always choose p₁ large enough to guarantee that the scheme is compatible with the requisite polynomials P. For example, if one only needs to work with fractions whose numerators and denominators are bounded (in absolute value) by M, then one simply chooses p₁ so that N=└√{square root over ((p₃−1)/2)}┘>>M. This creates a “bounded closure.”

6. Security Analysis

We present a discussion on the security properties of our construction from at least four perspectives: CPA indistinguishability, an analysis on encryptions of zero, factoring concerns, and an intrinsic hardness of Hensel codes that are meant to violate correctness boundaries.

6.1 Indistinguishability under Chosen Plaintext Attacks (CPA)

We present a variant of the AGCD assumption where the distinguisher is additionally given e, g, g′. For simplicity, we use (e; g; g0)-AGCD to denote the variant of the AGCD problem and (e, g, g′)-AGCD(p) to denote its associated distribution.

Definition 7 ((e, g, g′)-AGCD). Let u, v, p be primes such that |u|_(bits)=λ, |v|_(bits)=λ+3, |p|_(bits)=η, and |w′|_(bits)=η such that w=(w′)^(γ/μ), g=uvpw and g′=pw. We sample r, s←

₂ _(λ-1) , q←[uv, uvw)∩

, and σ←

₂ _(γ-η) and we compute e=H_(g)(H_(p)({tilde over (H)}_(u,v) ⁻¹(0, t))+σp). Finally, we compute x=H_(g)(r+qg′) and (e, g, g′)-AGCD(p) outputs x together with e, g, g′.

Lemma 6. For any message m∈

_(N,p) ₁ , we can perfectly simulate Enc_(pk, evk)(m) by obtaining x, e, g, g′ from (e, g, g′)-AGCD(p), sampling t←

₂ _(λ-1) , and outputting c=H_(g)(xg′+H_(g′)(te+m)).

Proof Fix m∈

_(N,u). We claim that the following simulated ciphertext c_(sim) decrypts to m: c_(sim)=H_(g′)(te+m)+qg′−kg, for some integer k. We further simplify to get c=H_(g′)(te+m)+αg′, where α=x−k(g/g′). It now follows immediately from the proof of correctness (Theorem 1, Eq. 6) that Dec_(sk,pk)(c_(sim))=m. Furthermore, we observe trivially that the simulated encryptions are distributed identically to the actual encryptions.

Definition 8. Consider the following experiment: a uniform η-bit prime p is chosen use along with a fixed message m from

₂ _(λ) . Then a uniform bit b←{0,1} is chosen. A distinguisher

is given g, g′ from (e, g, g′)-AGCD(p), and then:

If b=0, the distinguisher is given repeated random samples from (e, g, g′)-AGCD(p).

If b=1, the distinguisher is given repeated simulations of encryptions of m using samples from (e, g, g′)-AGCD(p) in the form H_(g)(xg′+H_(g′)(m)).

The distinguisher outputs a guess b′, and succeeds if b′=b. It E-distinguishes if Pr[b′=b]=½+∈.

Assumption 1. For any probabilistic polynomial-time distinguisher

, the probability that D is successful in the preceding experiment is negligible. That is, at best,

∈-distinguishes with ∈=∈(λ) negligible.

Theorem 2. The private-key leveled FHE scheme described in Section 5 is CPA-secure under Assumption 1.

Proof Fix an adversary

attacking the scheme. Construct an adversary

as follows:

is given repeated samples from (unknown) distribution.

runs

. When

requests an encryption of m, then

does: 1) Get a sample x from the given distribution, 2) Return a simulated ciphertext c (dependent on x) to

. When

outputs its challenge messages m₀, m₁ then

chooses a random bit b and does the exact same thing as above using the message m_(b). When

outputs a guess b′, then

outputs 1 if and only if b′=b.

Claim (1). When

is given samples from distribution (e, g, g′)-AGCD(p), then the probability that

outputs 1 is identical to

's success probability in the CPA experiment.

Proof(1). This follows since when

is given samples from distribution (e, g, g′)-AGCD, then

's view is identical to its view in the CPA experiment.

Claim (2). When

is given random samples from (e, g, g′)-AGCD(p), then the probability that

outputs 1 is ½.

Proof(2). This follows since

's view is independent of b. Indeed, for any message m,

can perfectly simulate a ciphertext for m using random samples from (e, g, g′)-AGCD(p). So, as per Lemma 6, the challenge ciphertext is computationally indistinguishable from a random element of (e, g, g′)-AGCD(p), which is independent of m regardless of the choice of b. It follows that

correctly outputs b′=b with probability exactly ½.

By Assumption 1, the difference in the probability that

outputs 1 when given samples from (e, g, g′)-AGCD(p) and the probability that it outputs 1 when given uniform samples is negligible. It follows from this and the above claims that the probability that A succeeds in the CPA experiment is ½+negl. This completes the proof.

6.2 Further Discussion of Security

Here we show that, under a particular assumption, ciphertexts are indistinguishable from random elements of

_(g).

Lemma 7. There are p₁ ²p₂ distinct encryptions of 0.

Proof. Encryptions of 0 are of the form Enc_(pk,evk)(0), where s←[0, p₁)∩

and δ←[p₁,p₂,p₁p₂p₄)∩

. We will show that each pair s, δ yields a unique encryption of 0. To this end, suppose s≠s′ or δ≠δ′ (mod p₁p₂). If H_(g)(H_(g′)(se)+δg′)=H_(g)(H_(g′)(s′e)+δ′g′), then we deduce that s=s′(mod g′). Since 0≤s, s′<g′, s=s′, a contradiction. All that remains is the case where s=s′ and δ≠δ′(mod p₁p₂). Again, if H_(g)(H_(g′)(se)+δg′)=H_(g)(H_(g′)(s′e)+δ′g′), then H_(g′)(se)=H_(g′)(s′e) implies δg′−kg=δ′g′−k′g, for some k, k′∈

. Rearranging the equation yields δ−δ′=(k−k′)p₁p₂, also a contradiction. The result follows from the fact that there are p₁ choices for s, and p₁p₂ choices for δ.

We now define an experiment in which a distinguisher tries to distinguish between a random subset of [0; g)∩

and a set of encryptions of 0.

Definition 9. Let

be a probabilistic polynomial-time distinguisher which knows the public-key pk=(e, g, g′). A uniform bit b←{0,1} and a random k≤p₁ ²p₂ are chosen, and then:

-   -   If b=0, then         is given a random subset of [0, g)∩         with k elements.     -   If b=1, then         is given a set k of random encryptions of 0.     -   outputs a guess b′∈{0,1} and succeeds if b=b′. Say         ∈-distinguishes if Pr[b′=b]=½+∈.

Assumption 2. The probability that

is successful in the preceding experiment is negligible. That is,

can only ∈-distinguish if ∈=∈(λ) is negligible.

Proposition 5. For a fixed m∈

_(N,p) ₁ , elements of the set Enc_(pk,evk) are indistinguishable from random elements of [0; g)∩

under Assumption 2.

Proof. Let m∈

_(N,p) ₁ , Enc_(pk,evk)(m)=Enc_(pk,evk)(m+0)=Enc_(pk,evk)(m)+Enc_(pk,evk)(m+0). By Assumption 2, encryptions of 0 are indistinguishable from random elements of [0; g)∩

, whence Enc_(pk,evk)(m)+Enc_(pk,evk)(m+0)=Enc_(pk,evk)(m) is indistinguishable from a random element of [0; g)∩

6.3 Factoring

The most obvious threat to our construction is also the easiest to thwart. It is associated with factoring attacks since the public evaluation key evk corresponds to g, which is the product of p₁, . . . , p₄. Successfully factoring g leads to a total break of the scheme since decryption only uses the knowledge of p₁ and p₃ according to Eq. 5. Even a partial factorization of g might lead to a total break of our scheme, as long as p₁ and p₃ are recovered. The main threat could be provided by some variation ECM factoring method (since p₄ in our scheme is not prime) with running time on the size of the smallest prime factor as opposed to the size of g. To prevent ECM threats, one must set the size of individual primes to be at least 512 bits and preferably at least 768 bits. Additionally, if g is sufficiently large (e.g., greater than or equal to 4096 bits), index calculus methods such as the Number Field Sieve method will not succeed.

6.4 Hensel Code Problem

We close this section with a proof that an adversary, knowing only g=p₁, . . . , p₄, g′=p₃p₄, and c=H_(g)(H_(g′)(x/y)+dg′), cannot deduce x/y using H_(g) ⁻¹ or H_(g′) ⁻¹. Furthermore, the range of the “noise parameter” can be restricted to guarantee that an adversary cannot even deduce the denominatory (a problem we noticed in some simulations).

Proposition 6. If α=g′ or g, then {tilde over (H)}_(α) ⁻¹(H_(g′)(se+m))≠m.

Proof Suppose by way of contradiction that H_(g′)(se+m)=H_(α)(m).

Let α=g′.

If we let m=x/y, then we get H_(g′)((sey+m)/y)=H_(g′)(x/y). Since p₁<<p₃, p₄, y is invertible modulo g′, whence (sey+x)y⁻¹=xy⁻¹(mod g′). It follows that se=0 (mod g′). Since s<p₁, we also have s invertible modulo (mod g′), which means e=0 (mod g′). In particular, we note that e=0 (mod p₄). But, since e=H_(p) ₁ _(,p) ₂ ⁻¹(0, s₂)+δ_(e)p₄, this implies H_(p) ₁ _(,p) ₂ ⁻¹(0, s₂)=0 (mod p₄). Put H_(p) ₁ _(,p) ₂ ⁻¹(0, s₂)=x₀/y₀. Since s₂≠0, x₀≠0. Moreover, since the inverse of y₀ modulo p₄ cannot be divisible by p₄, we conclude that x₀=0 (mod p₄). This contradicts 0<|x₀|└√{square root over ((p₁p₂−1)/2)}┘<p₄.

Let α=g.

Since g′|g, H_(g′)((sey+m)/y)=H_(g)(x/y) implies H_(g′)((sey+m)/y)=H_(g′)(x/y).

The result follows.

Lemma 8. Suppose {tilde over (H)}_(α) ⁻¹(H_(g′)(x/y))=x′/y′, where α=g or g′. If x≠x′ then y≠y′ or |x−x′|≥g′.

Proof Suppose α=g. Then H_(g′)(x/y)=H_(g)(x′/y′). We will prove the contrapositive. If y=y′ and |x−x′|<g′, then we use the fact that g′|g to obtain |x−x′|_(g′)=0. Since |x−x′| is less than g′, x=x′. The proof for α=g′ is analogous.

Proposition 7. Let x/y∈

_(N,p) ₁ , N=└√{square root over ((g′−1)/2)}┘, and α=g or g′. If

$\begin{matrix} {{s \in \left( {\frac{\left. {N +} \middle| x \right|}{\left. e \middle| y \right|},\ \frac{\left. {g^{\prime} - N +} \middle| x \right|}{\left. e \middle| y \right|}} \right)},{and}} & {{Eq}.8} \end{matrix}$ ${{{\overset{\sim}{H}}_{\alpha}^{- 1}\left( {H_{g^{\prime}}\left( {{se} + \frac{x}{y}} \right)} \right)} = \frac{x^{\prime}}{y^{\prime}}},$

then y≠y′.

Proof. In light of Lemma 8, it suffices to prove that x+sey≠x′ and |(x+sey)−x′|<g′.

If s>(N+|x|)/(e|y|), then

|x+sey|≥||x|−se|y||>x−(N+|x|)|=N.

Since |x′|≤N, by definition of {tilde over (H)}_(α) ⁻¹ (MEEA, in particular), we see that x+δp₄y≠x′.

Similarly, if 0<s<(g′−N−|x|)/|e|y||, then:

|(x+sey)|−x′|≤|x|+se|y|+N>|x|+(g′−N−|x|)+N=g′.

This completes the proof.

7. Practical Considerations

Among several alternative concrete parameter configurations we considered, the one we discuss in this work is not the most efficient in terms of ciphertext expansion. However, it is an instance that works as desired with respect to the homomorphic operations. As mentioned before, the noise growth on addition is still a concern. In our scheme, messages are members of a subset of the rational numbers so if we let two messages x₁/y₁ and x₂/y₂, be encrypted to two ciphertexts c₁ and c₂, then c₁·c₂ and c₁+c₂ will decrypt, respectively, to:

$\begin{matrix} {\frac{x_{1}x_{2}}{y_{1}y_{2}}{and}{}\frac{{x_{1}y_{2}} + {x_{2}y_{1}}}{y_{1}y_{2}}} & {{Eq}.9} \end{matrix}$

We note that the space taken up by addition is similar to the space taken up by multiplication (in the sense that the scheme admits a similar number of additions and multiplications), and acknowledge that this might be a downside for some applications.

Advantages of Working with Hensel Codes. Although there are some limiting aspects, we want to emphasize some of the advantages in working with Hensel codes. Recall that

=

_(N,p) ₁ . Considering that p₁ must be at least a 768-bit prime, its corresponding Nis a 384-bit number and, thus, the message space will be sufficiently large to include the solutions for most applications that require rational numbers as inputs. For instance, the set of rational numbers

_(N,p) ₁ includes integers (negative and positive) up to 384 bits. This is a message space large enough to contemplate a large class of real-world applications. Obviously, the larger p₁ is, the larger will be the message space. Perhaps one of the greatest takeaways is that we can merge error-free computation with homomorphic encryption via Hensel codes. As an immediate consequence, we can naturally compute the arithmetic gates addition, subtraction, multiplication, and division as follows: |c₁+c₂|_(g), |c₁−c₂|_(g), |c₁c₂|_(g) and |c₁/c₂|_(g), respectively. Correctness follows the discussion in Section 5.1. It is clear that addition, subtraction, and multiplication are computed in the natural way modulo g. For all c₁, c₂ output by Enc or Eval, the division |c₁/c₂|_(g), will work as long as gcd(c₂, g)=1. One simple way to ensure that division is always defined is to allow an encryption of zero to be public and implement the following division algorithm: Given c₁, c₂, g and a public encryption of zero c_(z), generate a uniform r_(c)←

₂ _(λ-1) and update c₂ as c₂=r_(c)c_(z)+c₂. If gcd(c₂, g)=1, compute and output |c₁/c₂|_(g), if not, repeat.

Given any homomorphic encryption that takes positive integers as valid messages, it is not surprising that one could easily provide a way for allowing that scheme to accept rational numbers as inputs. Given a rational number a/b (assumed to be positive, for simplicity), options include: 1) a simple modular encoding with a modulus q>a, b such that you have m=aq+b, 2) CRT with two moduli q₁, q₂>a, b such that m=CRT_(q) ₁ _(,q) ₂ (a, b), or yet 3) any pairing function, such as the Cantor pairing function, in which case we could obtain m=½ (a+b) (a+b+1)+b. None of the above options, along with many other numeric manipulations, preserve operations in the message space. Thus, since Hensel codes create an operation-preserving correspondence between a set of rationals and a set of integers, they are preferable as a tool for modifying existing schemes to take rational inputs.

7.1 Performance

The results presented in Table 1 were generated from experiments conducted with an implementation of our candidate scheme using Python 3.8.5, on a Mac-Book Pro 15-inch, MacOS High Sierra 10.13.6, 2.8 GHz Intel Core i7, 16 GB 1600 MHz DDR3, 500 GB HD. Each runtime (in seconds) presented is the arithmetic mean of 100 runs.

|p ₁|_(bits) =λ,|p ₂|_(bits)=λ+3,|p ₃|_(bits) −η,|p ₄|_(bits) =η,|p ₅|_(bits)=μ

We present practical results using two configurations. First, we set ρ=λ=512, d=10, which gives η=5120, μ=454653, γ=461571, |p₁|_(bits)=512, |p₂|_(bits)=515, |p₃|_(bits)=5120, |p₄|_(bits)=455672, |g′|_(bits)=460791, and |g|_(bits)=461818 (slightly larger than γ). Second, we set ρ=λ=768, d=20, which gives η=15360, μ=2927601, γ=2950275, |p₁|_(bits)=768, |p₂|_(bits)=771, |p₃|_(bits)=15360, |p₄|_(bits)=2933708, |g′|_(bits)=2949067, and |g|_(bits)=2950606. In Table 1 we display runtime results for the key generation, encryption, and decryption algorithms, and the homomorphic evaluation of the dot product of two 3D vectors.

TABLE 1 Runtime results Algorithm Runtime for λ =512; d = 10 Runtime λ = 768; d = 20 Key Generation 184.244738 927.6136270000001 Encryption 0.9383330000000001 35.50052400000004 Decryption 0.0067889999999977135 0.09174399999994876 3D vector dot product 0.3805450000000121 12.849364999999807

Hardware Implementation for a Private or Public-Key Leveled FHE Embodiment (FIG. 1)

FIG. 1 is a block diagram 100 of the hardware implementation for a private or public-key leveled Fully Homomorphic Encryption (FHE) embodiment. A source computing device 102 is connected over an electronic network/bus connection 108 to an intermediary computing device 104 and a destination device 106. Likewise, the intermediary computing device 104 and destination computing device 106 are, in turn, connected to each other 104, 106 as well as to the source computing device 102 over the electronic network/bus connection 108. In the embodiment shown in FIG. 1 , the source computing device 102 acts as the source of the encrypted data 110 and the source computing device 102 sends the encrypted data 110 over the network/bus connection 108 to the intermediary computing device 104 and/or the destination computing device 106. When the intermediary computing device 104 receives the encrypted data 110 from the source computing device 102, the intermediary computing device 104 may perform homomorphic Hensel Code arithmetic operations (addition, subtraction, multiplication, and/or division) with at least one additional ciphertext to obtain a result ciphertext 110 that the intermediary computing device 104 may then send over the network/bus connection 108 to the destination computing device 106. The destination computing device 106 may decrypt the received encrypted ciphertext 110 to obtain unencrypted data reflecting either the original message if the ciphertext 110 was the original ciphertext sent by the source computing device 102 or an unencrypted result of the arithmetic operations performed by the intermediary computing device 104 if the received ciphertext 110 is a result ciphertext sent by the intermediary computing device 104 after performing homomorphic arithmetic operations with the original ciphertext and at least one additional ciphertext. The destination device 104 generally acts as a final destination for the encrypted data 110 received from the network/bus connection 106 intended for decryption. Generally, communications, including concealed/encrypted communications, are bi-directional such that the source 102, intermediary 104, and destination 106 computing devices may change roles as the encrypted data 110 source 102, intermediary 104, and the encrypted data 110 destination 106 as is necessary to accommodate the transfer of data back and forth between the computing devices 102, 104, 106. Notably, the intermediary computing device 104 does not require knowledge of the secret keys to perform the homomorphic Hensel Code arithmetic operations, so it is likely that the intermediary computing device 104 will be at least computationally isolated from the source 102 and destination 106 computing devices. Additionally, while the computing devices 102, 104, 106 are depicted as separate devices in FIG. 1 , the functionality of the source computing device 102, the intermediary 104 and the destination device 106 may be shared on a single computing system/device or among two or more computing devices as it is often desirable to conceal data when transferring data between components of a single device.

Further, as shown in FIG. 1 , the source computing device 102 appears to be a laptop computer and the destination computing device 104 appears to be a tablet device and the intermediary computing device appears as a “cloud” that may represent one or several devices connected on the network 108 performing homomorphic arithmetic computations without a need to decrypt to the data 110 to obtain the correct decrypted value for the arithmetic operations. Generally, any computing device capable of communication over any form of electronic network or bus communication platform 106 may be one or more of the source 102, the intermediary 104, and destination 106 computing devices. Additionally, the source 102, intermediary 104 and/or destination 106 computing devices may actually be the same physical computing device communicating over an internal bus connection 108 with itself, but still desiring to encrypt transferred data to ensure that an attacker cannot monitor the internal communications bus 108 to obtain sensitive data communications in an unencrypted format.

Various embodiments may implement the network/bus communications channel 108 using any communications channel 108 capable of transferring electronic data between the source 102, intermediary 104, and destination 106 computing devices. For instance, the network/bus communication connection 108 may be an Internet connection routed over one or more different communications channels during transmission between the source 102, intermediary 104, and destination 106 devices. Likewise, the network/bus communication connection 108 may be an internal communications bus of a computing device, or even the internal bus of a processing or memory storage Integrated Circuit (IC) chip, such as a memory chip or a Central Processing Unit (CPU) chip. The network/bus communication channel 108 may utilize any medium capable of transmitting electronic data communications, including, but not limited to: wired communications, wireless electro-magnetic communications, fiber-optic cable communications, light/laser communications, sonic/sound communications, etc., and any combination thereof of the various communication channels.

The various embodiments may provide the control and management functions detailed herein via an application operating on the source 102, intermediary 104, and/or destination 106 computing devices. The source 102, intermediary 104, and/or destination 106 computing devices may each be a computer or computer system, or any other electronic devices device capable of performing the communications and computations of an embodiment. The source 102, intermediary 104, and/or destination 106 devices may include, but are not limited to: a general-purpose computer, a laptop/portable computer, a tablet device, a smart phone, an industrial control computer, a data storage system controller, a CPU, a Graphical Processing Unit (GPU), an Application Specific Integrated Circuit (ASI), and/or a Field Programmable Gate Array (FPGA). Notably, the first 102, second 104, and/or third 106 computing devices may be the storage controller of a data storage media (e.g., the controller for a hard disk drive) such that data delivered to/from the data storage media is always encrypted so as to limit the ability of an attacker to ever have access to unencrypted data. Embodiments may be provided as a computer program product which may include a computer-readable, or machine-readable, medium having stored thereon instructions which may be used to program/operate a computer (or other electronic devices) or computer system to perform a process or processes in accordance with the various embodiments. The computer-readable medium may include, but is not limited to, hard disk drives, floppy diskettes, optical disks, Compact Disc Read-Only Memories (CD-ROMs), Digital Versatile Disc ROMS (DVD-ROMs), Universal Serial Bus (USB) memory sticks, magneto-optical disks, ROMs, random access memories (RAMs), Erasable Programmable ROMs (EPROMs), Electrically Erasable Programmable ROMs (EEPROMs), magnetic optical cards, flash memory, or other types of media/machine-readable medium suitable for storing electronic instructions. The computer program instructions may reside and operate on a single computer/electronic device or various portions may be spread over multiple computers/devices that comprise a computer system. Moreover, embodiments may also be downloaded as a computer program product, wherein the program may be transferred from a remote computer to a requesting computer by way of data signals embodied in a carrier wave or other propagation medium via a communication link (e.g., a modem or network connection, including both wired/cabled and wireless connections).

Operational Flow Chart for a Private-Key Leveled FHE Embodiment (FIG. 2)

FIG. 2 is a flow chart 200 of operations for a private-key leveled FHE embodiment. At process 216, the source computing device 202 generates prime numbers p₁ . . . p₅ as a function of provided parameters λ and d. Given the parameter and the parameter d, then ρ, η, γ, and μ are defined as follows: ρ=λ, η=2(d+2)λ, μ=γ−η−2λ, and

$\gamma = {\frac{\lambda}{\log_{2}(\lambda)}\left( {\eta - \rho} \right)^{2}}$

such that the bit widths are computed as

❘p₁❘_(bits) = ρ + 1, ${{❘p_{2}❘}_{bits} = {{❘p_{3}❘}_{bits} = \frac{\rho}{2}}},$ ❘p₄❘_(bits) = η, ❘p₅❘_(bits) = μ,

and |g|_(bits)=γ. At process 218, the source computing device 202 sets a secret key sk to be comprised of the prime numbers p₁ . . . p₅ wherein the secret key is known to both of the source computing device 202 and the destination computing device 206 but not to other computing devices, including the intermediary computing device 204. At process 220, the source computing device 202 sets a public evaluation key evk to be equal to a product (Π_(i=1) ⁵ p_(i)) of the prime numbers p₁ . . . p₅ wherein the public evaluation key evk also equals a g of Hensel Code g-adic computations (H_(g)). Processes 216-220 are part of a Gen (generate) 208 subsystem/algorithm that performs the necessary operations to generate the necessary security keys for the encryption operations.

At process 222, the source computing device 206 generates uniform and independent values s₁, s₂, s₃, and δ as a function of the prime numbers p₂ . . . p₄, the parameter λ, and the value g such that s₁←

₂ _(λ-1) , s₂←

_(p) ₂ , s₃←

_(p) ₃ , and δ←

_(g/p) ₄ . At process 224, the source computing device 206 encrypts a message m as ciphertext c in accord with Hensel Code encryption computation c=|H_(g)(s₁·{tilde over (H)}_(p) ₁ _(,p) ₂ _(,p) ₃ ⁻¹(0, s₂, s₃)+δ_(p) ₄ )|. Processes 222-224 are part of an Enc (encrypt) 210 subsystem/algorithm that performs the necessary operations to encrypt the message m. At process 226, the source computing device 202 sends the ciphertext c to the destination computing device 206 if no homomorphic calculations are desired, or to the intermediary computing device 204 if homomorphic calculations are desired.

The processes 228-230 of the intermediary computing device 204 are not necessary if it is not desired to perform homomorphic calculations with at least one additional ciphertext c_(additional) to obtain a result ciphertext c_(result), in which case the original ciphertext c may simply be sent to the destination computing device 206 for decryption. Assuming homomorphic calculation operations are desired, at process 228, the intermediary computing device 204 homomorphically computes at least one arithmetic function with said ciphertext c and at least one additional ciphertext c_(additional) in accord with Hensel Code arithmetic functions over integers modulo g to obtain a result ciphertext c_(result). The potential arithmetic functions are one or more of addition, subtraction, multiplication, and division. Notably, the intermediary computing device 204 does not have knowledge of the secret key sk, but does have knowledge of the public evaluation key evk that equals the g of the Hensel Code g-adic computations (H_(g)). Process 228 is part of an Eval (evaluate) 212 subsystem/algorithm that performs the necessary operations to perform homomorphic calculations on encrypted data. At process 230, the intermediary computing device 204 sends the result ciphertext c_(result) to the destination computing device 206.

At process 232, the destination computing device 206 decrypts the ciphertext c or the result ciphertext c_(result) into an unencrypted value (message m or the unencrypted calculation result r, as appropriate) in accord with Hensel Code decryption computation m (or r)=H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₄ ⁻¹(c))). Process 232 is part of an Dec (decrypt) 214 subsystem/algorithm that performs the necessary operations to decrypt encrypted data.

Operational Flow Chart for a Public-Key Leveled FHE Embodiment (FIG. 3)

FIG. 3 is a flow chart 300 of operations for a public-key leveled FHE embodiment. At process 316, the source computing device 302 generates prime numbers p₁, p₂, p₃, and p₄ as a function of provided parameters λ and d. Given the parameter and the parameter d, then ρ, η, γ, and, μ are defined as follows: ρ=λ, η=dλ, μ=d²λ log₂(λ)−η−2λ−3, and γ=2η+(3λ)/2+μ+3 such that the bit widths are computed as |p₁|_(bits)=λ, |p₂|_(bits)=λ+3, |p₃|_(bits)=η, and |p′₄|_(bits)=η. At process 318, the source computing device 302 computes a value p₄ as a function of the prime number p₄ and the parameters λ and d, such that p₄ as p₄=(p′₄)^(μ/η+1). At process 320, the source computing device 302 sets a value g of Hensel Code g-adic computations (H_(g)) to a product of the values p₁, p₂, p₃, p₄ and a value g′ of Hensel Code g′-adic computations (H_(g′)) to a product of the values p₃, p₄. At process 322, the source computing device 302 generates values t and δ_(e) as a function of said parameters λ and d where the values t and δ_(e), are restricted such that t←

₂ _(λ-1) and δ_(e)←

₂ _(λ-n) . At process 324, the source computing device 302 computes a value e in accord with Hensel Code value e computation e=H_(g)(H_(p) ₃ ({tilde over (H)}_(p) ₁ _(,p) ₂ ⁻¹(0, t))+δ_(e)p₃). At process 326, the source computing device 302 computes a secret key sk that is comprised of the prime numbers p₁ and p₃ wherein the secret key sk is known to both of the source computing device 302 and the destination computing device 306, but not to other computing devices, including the intermediary computing device 304. At process 328, the source computing device 302 sets a public key pk that is comprised of the values e, g′, g=evk. Processes 316-328 are part of a Gen (generate) 308 subsystem/algorithm that performs the necessary operations to generate the necessary security keys for the encryption operations.

At process 330, the source computing device 306 generates uniform and independent values s₁, s₂ as a function of said parameter λ, and a value δ as a function of said values p₁, p₂, p₄ where the values s₁, s₂ and δ_(e), are restricted such that s₁←

₂ _(λ-1) , s₂←

_(p) ₂ , s₁, s₂←

₂ _(λ-η) and δ←[p₁p₂, p₁p₂p₄)∩

. At process 332, the source computing device 306 encrypts a message m as ciphertext c in accord with Hensel Code encryption computation c=H_(g)(H_(g′)(s₁e+m)+s₂g′+S(g′)²). Processes 330-332 are part of an Enc (encrypt) 310 subsystem/algorithm that performs the necessary operations to encrypt the message m. At process 334, the source computing device 302 sends the ciphertext c to the destination computing device 306 if no homomorphic calculations are desired, or to the intermediary computing device 304 if homomorphic calculations are desired.

The processes 336-338 of the intermediary computing device 304 are not necessary if it is not desired to perform homomorphic calculations with at least one additional ciphertext c_(additional) to obtain a result ciphertext c_(result), in which case the original ciphertext c may simply be sent to the destination computing device 306 for decryption. Assuming homomorphic calculation operations are desired, at process 336, the intermediary computing device 304 homomorphically computes at least one arithmetic function with said ciphertext c and at least one additional ciphertext c_(additional) in accord with Hensel Code arithmetic functions over integers modulo g to obtain a result ciphertext c_(result). The potential arithmetic functions are one or more of addition, subtraction, multiplication, and division. Notably, the intermediary computing device 304 does not have knowledge of the secret key sk, but does have knowledge of the public key pk that includes the g of the Hensel Code g-adic computations (H_(g)). Process 336 is part of an Eval (evaluate) 312 subsystem/algorithm that performs the necessary operations to perform homomorphic calculations on encrypted data. At process 3380, the intermediary computing device 304 sends the result ciphertext c_(result) to the destination computing device 306.

At process 340, the destination computing device 306 decrypts the ciphertext c or the result ciphertext c_(result) into an unencrypted value (message m or the unencrypted calculation result r, as appropriate) in accord with Hensel Code decryption computation m (or r)=H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₄ ⁻¹(c))). Process 340 is part of an Dec (decrypt) 314 subsystem/algorithm that performs the necessary operations to decrypt encrypted data.

The foregoing description of the invention has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed, and other modifications and variations may be possible in light of the above teachings. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application to thereby enable others skilled in the art to best utilize the invention in various embodiments and various modifications as are suited to the particular use contemplated. 

What is claimed is:
 1. A method for private-key Fully Homomorphic Encryption (FHE) communication of a message m between a source computing device and a destination computing device, the method comprising: generating by said source computing device prime numbers p₁ . . . p₅ as a function of provided parameters λ and d; setting by said source computing device a secret key sk to be comprised of said prime numbers p₁ . . . p₅ wherein said secret key is known to both of said source computing device and said destination computing device but not to other computing devices; setting by said source computing device a public evaluation key evk to be equal to a product (Π_(i=1) ⁵ p_(i)) of said prime numbers p₁ . . . p₅ wherein said evk also equals a g of Hensel Code g-adic computations (H_(g)); generating by said source computing device values s₁, s₂, s₃, and δ as a function of said prime numbers p₂ . . . p₄, said parameter λ, and said value g; encrypting by said source computing device said message m as ciphertext c in accord with Hensel Code encryption computation c=|H_(g)(s₁·{tilde over (H)}_(p) ₁ _(,p) ₂ _(,p) ₃ ⁻¹(0, s₂, s₃)+δp₄)|_(g); sending by said source computing device said ciphertext c to said destination computing device; decrypting by said destination computing device said ciphertext c back into said message m in accord with Hensel Code decryption computation m=H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₄ ⁻¹(c))).
 2. The method of claim 1: wherein said process of sending by said source computing device said ciphertext c to said destination computing device instead sends said ciphertext c to an intermediary computing device; wherein said intermediary computing device does not have knowledge of said secret key sk, but does have knowledge of said public evaluation key evk that equals said g of said Hensel Code g-adic computations (H_(g)); wherein the method of claim 1 further comprises: homomorphically computing by said intermediary computing device at least one arithmetic function with said ciphertext c and at least one additional ciphertext c_(additional) in accord with Hensel Code arithmetic functions over integers modulo g to obtain a result ciphertext c_(result); and sending by said intermediary computing device said result ciphertext c_(result) in place of said ciphertext c to said destination computing device; and wherein said process of decrypting by said destination computing device said ciphertext c back into said message m instead decrypts said ciphertext c_(result) to obtain a result r equal to an unencrypted computation of said arithmetic functions homomorphically performed as said Hensel code arithmetic functions with said ciphertext c and said at least one additional ciphertext c_(additional).
 3. The method of claim 1 further comprising: computing by said source computing device said values ρ, ρ, γ, and μ as functions of said parameters λ and d such that ρ=λ, η=2(d+2)λ, μ=γ−η−2λ, and ${\gamma = {\frac{\lambda}{\log_{2}(\lambda)}\left( {\eta - \rho} \right)^{2}}};$ and computing by said source computing device bit widths as functions of said values ρ, η, γ, and μ and said parameters λ and d such that ❘p₁❘_(bits) = ρ + 1, ${{❘p_{2}❘}_{bits} = {{❘p_{3}❘}_{bits} = \frac{\rho}{2}}},$ ❘p₄❘_(bits) = η, ❘p₅❘_(bits) = μ, and ❘g❘_(bits) = γ; and wherein said values s₁, s₂, s₃, and δ are restricted such that s₁←

₂ _(λ-1) , s₂←

_(p) ₂ , s₃←

_(p) ₃ , and δ←

_(g/p) ₄ .
 4. The method of claim 1 wherein said arithmetic functions are at least one of group of arithmetic functions chosen from: addition, subtraction, multiplication, and division.
 5. A method for public-key Fully Homomorphic Encryption (FHE) communication of a message m between a source computing device and a destination computing device, the method comprising: generating by said source computing device prime numbers p₁, p₂, p₃, and p′₄ as a function of provided parameters λ and d; computing by said source computing device a value p₄ as a function of said prime number p′₄ and said parameters λ and d; setting by said source computing device a value g of Hensel Code g-adic computations (H_(g)) to a product of said values p₁, p₂, p₃, p₄ and a value g′ of Hensel Code g′-adic computations (H_(g′)) to a product of said values p₃, p₄; generating by said source computing device values t and δ_(e) as a function of said parameters λ and d; computing by said source computing device a value e in accord with Hensel Code value e computation e=H_(g)(H_(p) ₃ ({tilde over (H)}_(p) ₁ _(,p) ₂ ⁻¹(0, t))+δ_(e)p₃); setting by said source computing device a secret key sk to be comprised of said prime numbers p₁ and p₃ wherein said secret key skis known to both of said source computing device and said destination computing device but not to other computing devices; setting by said source computing device a public key pk to be comprised of said values e, g′, g=evk; generating by said source computing device values s₁, s₂ as a function of said parameter λ, and a value δ as a function of said values p₁, p₂, p₄; encrypting by said source computing device said message m as ciphertext c in accord with Hensel Code encryption computation c=H_(g)(H_(g′)(s₁e+m)+s₂g′+δ(g′)²); sending by said source computing device said ciphertext c to said destination computing device; decrypting by said destination computing device said ciphertext c back into said message m in accord with Hensel Code decryption computation m=H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₃ ⁻¹(c))).
 6. The method of claim 5: wherein said process of sending by said source computing device said ciphertext c to said destination computing device instead sends said ciphertext c to an intermediary computing device; wherein said intermediary computing device does not have knowledge of said secret key sk, but does have knowledge of said public key pk that includes said g of said Hensel Code g-adic computations (H_(g)); wherein the method of claim 4 further comprises: homomorphically computing by said intermediary computing device at least one arithmetic function with said ciphertext c at least one additional ciphertext c_(additional) in accord with Hensel Code arithmetic functions over integers modulo g to obtain a result ciphertext c_(result); and sending by said intermediary computing device said result ciphertext c_(result) in place of said ciphertext c to said destination computing device; and wherein said process of decrypting by said destination computing device said ciphertext c back into said message m instead decrypts said ciphertext c_(result) to obtain a result r equal to an unencrypted computation of said arithmetic functions homomorphically performed as said Hensel code arithmetic functions with said ciphertext c and said at least one additional ciphertext c_(additional).
 7. The method of claim 5 further comprising: computing by said source computing device said values ρ, η, γ, and μ as functions of said parameters λ and d such that ρ=λ, η=dλ, μ=d²λ log₂(λ)−η−2λ−3, and γ=2η+(3λ)/2+μ+3; and computing by said source computing device bit widths as functions of said values ρ, η, γ, and μ and said parameters λ and d such that |p₁|_(bits)=λ, |p₂|_(bits)=λ+3, |p₃|_(bits)=η, and |p′₄|_(bits)=η; and wherein said values t, δ_(e), s₁, s₂, and δ are restricted such that t←

₂ _(λ-1) , δ_(e)←

₂ _(λ-η) , s₁←

₂ _(λ-1) , s₂←

_(p) ₂ , s₁, s₂←

₂ _(λ-η) and δ←[p₁p₂,p₁p₂p₄)∩

; and wherein said process of computing by said source computing device said value p₄ computes said value of p₄ as p₄=(p′₄)^(μ/η+1).
 8. The method of claim 5 wherein said arithmetic functions are at least one of group of arithmetic functions chosen from: addition, subtraction, multiplication, and division.
 9. A private-key leveled Fully Homomorphic Encryption (FHE) system that communicates a message m between a source computing device and a destination computing device, the private-key leveled FHE system comprising: said source computing device, wherein said source device further comprises: a Gen subsystem that generates device prime numbers p₁ . . . p₅ as a function of provided parameters λ and d, sets a secret key sk to be comprised of said prime numbers p₁ . . . p₅ wherein said secret key is known to both of said source computing device and said destination computing device but not to other computing devices, sets a public evaluation key evk to be equal to a product (Π_(i=1) ⁵ p_(i)) of said prime numbers p₁ . . . p₅ wherein said evk also equals a g of Hensel Code g-adic computations (H_(g)); an Enc subsystem that generates device values s₁, s₂, s₃, and δ as a function of said prime numbers p₂ . . . p₄, said parameter λ, and said value g, encrypts said message m as ciphertext c in accord with Hensel Code encryption computation c=|H_(g)(s₁·{tilde over (H)}_(p) ₁ _(,p) ₂ _(,p) ₃ ⁻¹(0, s₂, s₃)+δp₄)_(g); a ciphertext send subsystem that sends said ciphertext c to said destination computing device; and said destination computing device, wherein said destination computing device further comprises: a Dec subsystem that decrypts said ciphertext c back into said message m in accord with Hensel Code decryption computation m=H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₄ ⁻¹(c))).
 10. The private-key leveled FHE system of claim 9: wherein said ciphertext send subsystem sends said ciphertext c to an intermediary computing device; wherein said intermediary computing device does not have knowledge of said secret key sk, but does have knowledge of said public evaluation key evk that equals said g of said Hensel Code g-adic computations (H_(g)); wherein the private-key leveled FHE system of claim 9 further comprises: an Eval subsystem that homomorphically computes at least one arithmetic function with said ciphertext c and at least one additional ciphertext c_(additional) in accord with Hensel Code arithmetic functions over integers modulo g to obtain a result ciphertext c_(result); and a result ciphertext send subsystem that sends said result ciphertext c_(result) in place of said ciphertext c to said destination computing device; and wherein said Dec subsystem decrypts said ciphertext c_(result) to obtain a result r equal to an unencrypted computation of said arithmetic functions homomorphically performed as said Hensel code arithmetic functions with said ciphertext c and said at least one additional ciphertext c_(additional).
 11. The private-key leveled FHE system of claim 9: wherein said Gen subsystem further computes said values ρ, η, γ, and μ as functions of said parameters λ and d such that ρ=λ, η=2(d+2)λ, μ=γ−η−2λ, and ${\gamma = {\frac{\lambda}{\log_{2}(\lambda)}\left( {\eta - \rho} \right)^{2}}};$ wherein said Gen subsystem further computes device bit widths as functions of said values ρ, η, γ, and μ and said parameters λ and d such that ❘p₁❘_(bits) = ρ + 1, ${{❘p_{2}❘}_{bits} = {{❘p_{3}❘}_{bits} = \frac{\rho}{2}}},$ ❘p₄❘_(bits) = η, ❘p₅❘_(bits) = μ, ❘g❘_(bits) = γ; wherein said Enc subsystem further restricts said values s₁, s₂, s₃, and δ such that s₁←

₂ _(λ-1) , s₂←

_(p) ₂ , s₃←

_(p) ₃ , and δ←

_(g/p) ₄ .
 12. The private-key leveled FHE system of claim 9 wherein said arithmetic functions are at least one of group of arithmetic functions chosen from: addition, subtraction, multiplication, and division.
 13. A public-key leveled Fully Homomorphic Encryption (FHE) system that communicates a message m between a source computing device and a destination computing device, the private-key leveled FHE system comprising: said source computing device, wherein said source device further comprises: a Gen subsystem that generates prime numbers p₁, p₂, p₃, and p′₄ as a function of provided parameters λ and d, computes a value p₄ as a function of said prime number p′₄ and said parameters λ and d, sets a value g of Hensel Code g-adic computations (H_(g)) to a product of said values p₁, p₂, p₃, p₄ and a value g′ of Hensel Code g′-adic computations (H_(g′)) to a product of said values p₃, p₄, generates values t and δ_(e) as a function of said parameters λ and d, computes a value e in accord with Hensel Code value e computation e=H_(g)(H_(p) ₃ ({tilde over (H)}_(p) ₁ _(,p) ₂ ⁻¹(0, t))+δ_(e)p₃), sets a secret key sk to be comprised of said prime numbers p₁ and p₃ wherein said secret key skis known to both of said source computing device and said destination computing device but not to other computing devices, and sets a public key pk to be comprised of said values e, g′, g=evk; an Enc subsystem that generates values s₁, s₂ as a function of said parameter λ, and a value δ as a function of said values p₁, p₂, p₄, and encrypts said message m as ciphertext c in accord with Hensel Code encryption computation c=H_(g)(H_(g′)(s₁e+m)+s₂g′+((g′)²); a ciphertext send subsystem that sends said ciphertext c to said destination computing device; and said destination computing device, wherein said destination computing device further comprises: a Dec subsystem that decrypts said ciphertext c back into said message m in accord with Hensel Code decryption computation m=H_(p) ₁ ⁻¹(H_(p) ₁ (H_(p) ₃ ⁻¹(c))).
 14. The public-key leveled FHE system of claim 13: wherein said ciphertext send subsystem sends said ciphertext c to an intermediary computing device; wherein said intermediary computing device does not have knowledge of said secret key sk, but does have knowledge of said public key pk that includes said g of said Hensel Code g-adic computations (H_(g)) wherein the private-key leveled FHE system of claim 9 further comprises: an Eval subsystem that homomorphically computes at least one arithmetic function with said ciphertext c and at least one additional ciphertext c_(additional) in accord with Hensel Code arithmetic functions over integers modulo g to obtain a result ciphertext c_(result); and a result ciphertext send subsystem that sends said result ciphertext c_(result) in place of said ciphertext c to said destination computing device; and wherein said Dec subsystem decrypts said ciphertext c_(result) to obtain a result r equal to an unencrypted computation of said arithmetic functions homomorphically performed as said Hensel code arithmetic functions with said ciphertext c and said at least one additional ciphertext c_(additional).
 15. The public-key leveled FHE system of claim 13: wherein said Gen subsystem further computes said values ρ, η, γ, and μ as functions of said parameters λ and d such that ρ=λ, η=dλ, μ=d²λ log₂(λ)−η−2λ−3, and γ=2η+(3λ)/2+μ+3; wherein said Gen subsystem further computes bit widths as functions of said values ρ, η, γ, and μ and said parameters λ and d such that |p₁|_(bits)=λ, |p₂|_(bits)=λ+3, |p₃|_(bits)=η, and |p′₄|_(bits)=η; wherein said Gen subsystem further computes said value p₄ as p₄=(p′₄)^(μ/η+1); wherein said Gen subsystem further restricts said values t and δ_(e), such that t←

₂ _(λ-1) and δ_(e)←

₂ _(λ-η) ; and wherein said Enc subsystem further restricts said values s₁, s₂, and δ such s₁←

_(2λ-1), s₂←

_(p) ₂ , s₁, s₂←

₂ _(λ-η) , and δ←[p₁p₂, p₁p₂p₄)∩

.
 16. The public-key leveled FHE system of claim 13 wherein said arithmetic functions are at least one of group of arithmetic functions chosen from: addition, subtraction, multiplication, and division. 